Scripting Rsync include and exclude

Sc00T

Solid State Member
Messages
13
Location
Colorado
Hi,

I am trying to script rsync to quickly dump the cache files from the firefox browser on OSx. I am having an issue with the --inlcude and --exclude options. To simplify the question, below is just an example of what the source directory could be:

Code:
$HOME/Library/App/Firefox/Profile/RandomDir/cache
I was initially using rsync to just sync the cache directory, however OSx was not interpreting the wildcard in the source path. The command i was using was:

Code:
rsync -avP $HOME/Library/App/Firefox/*/cache Source/Dir
When i would run this command OSx was unable to find the directory because it was looking for the literal interpenetration of Firefox/*/ and the * was not being translated.

I then next tried to implement the --include and --exclude options however i have been unable to get this to work.

I was using:
Code:
rsync -avP --include="*/" --include="cache/" --exclude"*" $HOME/Library/App/Firefox SourceDir/
When I run this command it tells me that 0 files were considered. It is my understanding that Rsync implements the includes and excludes in the order that they are enter, so my logic is that rsync will include everything under the Firefox directory, then only include the cache directory, then it would exclude everything else.

Can anyone tell where I'm going wrong here? I've tried several variants of the command for example --include="*/cache" and --exclude="*/*", but obviously none have worked so far. Any help at all is greatly appreciated. Thank you.
 
Back
Top Bottom