LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-09-2014, 05:14 AM   #1
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Question 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.
 
Old 05-09-2014, 06:02 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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?
 
Old 05-09-2014, 06:13 AM   #3
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by unSpawn View Post
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.
 
Old 05-09-2014, 06:30 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by LinusStallman View Post
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 View Post
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?
 
Old 05-09-2014, 08:38 AM   #5
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
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?
 
Old 05-09-2014, 09:58 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by LinusStallman View Post
This worked fine.
So you're sure ending slashes don't matter?..


Quote:
Originally Posted by LinusStallman View Post
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 View Post
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 View Post
What exactly does -avrSW do?
What does the manual page say it does?
 
Old 05-09-2014, 10:32 AM   #7
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by LinusStallman View Post
What exactly does -avrSW do?
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
 
1 members found this post helpful.
Old 05-09-2014, 10:32 AM   #8
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by LinusStallman View Post
What exactly does -avrSW do?
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
 
1 members found this post helpful.
Old 05-10-2014, 09:31 AM   #9
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Quote:
Originally Posted by unSpawn View Post
...
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.
 
Old 05-10-2014, 09:33 AM   #10
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Wink

Quote:
Originally Posted by szboardstretcher View Post
Archive mode, verbosity, recursive, handle sparse files, whole file copy(no deltas).
Nice one szboardstretcher.
 
Old 05-10-2014, 02:03 PM   #11
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
Quote:
Originally Posted by LinusStallman View Post
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.
 
Old 05-10-2014, 02:08 PM   #12
linustalman
LQ Guru
 
Registered: Mar 2010
Location: Ireland
Distribution: Debian 12 Bookworm
Posts: 5,833

Original Poster
Rep: Reputation: 479Reputation: 479Reputation: 479Reputation: 479Reputation: 479
Thanks lleb, szboardstretcher and unSpawn. I appreciate your help.
 
  


Reply

Tags
exclude, grsync, include


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Destination files different to the source are not being deleted with Grsync linustalman Linux - Networking 4 12-18-2013 10:43 AM
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 04:58 AM
[SOLVED] 'find' command regex to exclude hidden files? arashi256 Linux - Newbie 3 06-28-2010 09:53 AM
Can we use exclude option in"rm" command to exclude some files/folders? yadav_rk727 Linux - Newbie 1 02-03-2010 11:14 AM
bash: mv hidden and not hidden files lupe Linux - General 4 06-22-2009 02:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration