Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-09-2014, 05:14 AM
|
#1
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
|
Exclude all hidden files except a few with Grsync.
Hi.
I sync between my desktop and laptop. The laptop has a fairly small HDD capacity.
I use Grsync with an exclude list.
Code:
--exclude-from=Exclude.txt
It contains:
Code:
.*
gPodder
VirtualBox VMs
I'd like though to sync my .mozilla and .thunderbird folders. How can I do this while ignoring all other hidden files?
Thanks.
|
|
|
05-09-2014, 06:02 AM
|
#2
|
Moderator
Registered: May 2001
Posts: 29,415
|
Two ways: either specify all dot-name directories in your exclude list excluding the .mozilla and .thunderbird directories ('find /home/LinusStallman -maxdepth 1 -type d -iname \.\* | egrep -vie "(mozilla|thunderbird)";') or run two rsync jobs, the second one only including the .mozilla and .thunderbird directories w/o exclude list?
|
|
|
05-09-2014, 06:13 AM
|
#3
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
Original Poster
|
Quote:
Originally Posted by unSpawn
Two ways: either specify all dot-name directories in your exclude list excluding the .mozilla and .thunderbird directories ('find /home/LinusStallman -maxdepth 1 -type d -iname \.\* | egrep -vie "(mozilla|thunderbird)";') or run two rsync jobs, the second one only including the .mozilla and .thunderbird directories w/o exclude list?
|
Hi unSpawn.
So I'd put 'find /home/LinusStallman -maxdepth 1 -type d -iname \.\* | egrep -vie "(mozilla|thunderbird)";' in the exclude.txt file?
For the second option. How could I run rsync and only sync .mozilla and .thunderbird without deleting all other files on the laptop (destination)? I use the --delete option. So say I want to completely delete any files in .mozilla and .thunderbird that are not on my desktops .mozilla and .thunderbird folders while not affecting any other files on my laptop when syncing.
Last edited by linustalman; 05-09-2014 at 06:22 AM.
|
|
|
05-09-2014, 06:30 AM
|
#4
|
Moderator
Registered: May 2001
Posts: 29,415
|
Quote:
Originally Posted by LinusStallman
So I'd put 'find /home/LinusStallman -maxdepth 1 -type d -iname \.\* | egrep -vie "(mozilla|thunderbird)";' in the exclude.txt file?
|
No, the result of it.
Quote:
Originally Posted by LinusStallman
For the second option. How could I run rsync and only sync .mozilla and .thunderbird without deleting all other files on the laptop (destination)? I use the --delete option. So say I want to completely delete any files in .mozilla and .thunderbird that are not on my desktops .mozilla and .thunderbird folders while not affecting any other files on my laptop when syncing.
|
It's a path thing: say if you would use 'rsync -avrSW /home/LinusStallman/ /destination/home/LinusStallman/' to sync your complete home then to only rsync a subdirectory of it you could use 'rsync -avrSW /home/LinusStallman/ .mozilla/ /destination/home/LinusStallman/ .mozilla/'.
---------- Post added 09-05-14 at 05:30 ----------
*Use "--dry-run" (or "-n") to safely test things OK?
|
|
|
05-09-2014, 08:38 AM
|
#5
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
Original Poster
|
This worked fine. Does it completely delete all files on my laptop .mozilla that are not on my desktop .mozilla folder?
Code:
rsync -avrSW /home/LS/.mozilla/ 192.168.1.15:/home/LS/.mozilla && rsync -avrSW /home/LS/.thunderbird/ 192.168.1.15:/home/LS/.thunderbird
Is there a way for it to only ask for my laptop password once? Also is the a tidier way of writing the above code?
What exactly does -avrSW do?
|
|
|
05-09-2014, 09:58 AM
|
#6
|
Moderator
Registered: May 2001
Posts: 29,415
|
Quote:
Originally Posted by LinusStallman
This worked fine.
|
So you're sure ending slashes don't matter?..
Quote:
Originally Posted by LinusStallman
Does it completely delete all files on my laptop .mozilla that are not on my desktop .mozilla folder?
|
Did you use "--delete"?
Quote:
Originally Posted by LinusStallman
Is there a way for it to only ask for my laptop password once? Also is the a tidier way of writing the above code?
|
Which "laptop password"? If it's due to rsync-over-SSH then use ssh-agent.
Quote:
Originally Posted by LinusStallman
What exactly does -avrSW do?
|
What does the manual page say it does?
|
|
|
05-09-2014, 10:32 AM
|
#7
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Quote:
Originally Posted by LinusStallman
What exactly does -avrSW do?
|
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
|
|
1 members found this post helpful.
|
05-09-2014, 10:32 AM
|
#8
|
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278
|
Quote:
Originally Posted by LinusStallman
What exactly does -avrSW do?
|
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
|
|
1 members found this post helpful.
|
05-10-2014, 09:31 AM
|
#9
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
Original Poster
|
Quote:
Originally Posted by unSpawn
...
Which "laptop password"? If it's due to rsync-over-SSH then use ssh-agent.
...
|
Yes, the laptop password (PC#2). How would I use ssh-agent?
---------- Post added 10-05-14 at 02:32 PM ----------
How about this?
Code:
rsync -r -t -v --progress --delete -l /home/LS/.mozilla/ 192.168.1.15:/home/LS/.mozilla/
I'm not that bothered about syncing Thunderbird too often.
Last edited by linustalman; 05-10-2014 at 10:08 AM.
|
|
|
05-10-2014, 09:33 AM
|
#10
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
Original Poster
|
Quote:
Originally Posted by szboardstretcher
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
|
Nice one szboardstretcher.
|
|
|
05-10-2014, 02:03 PM
|
#11
|
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983
|
Quote:
Originally Posted by LinusStallman
Yes, the laptop password (PC#2). How would I use ssh-agent?
---------- Post added 10-05-14 at 02:32 PM ----------
How about this?
Code:
rsync -r -t -v --progress --delete -l /home/LS/.mozilla/ 192.168.1.15:/home/LS/.mozilla/
I'm not that bothered about syncing Thunderbird too often.
|
see the links in my signature for setting up ssh keys. that way it will run without asking for your p/w. very very useful for scripting.
|
|
|
05-10-2014, 02:08 PM
|
#12
|
LQ Guru
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833
Original Poster
|
Thanks lleb, szboardstretcher and unSpawn. I appreciate your help.
|
|
|
All times are GMT -5. The time now is 09:17 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|