Scripting Rsync include and exclude - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Programming
Click Here to Login
Reply
 
Thread Tools Display Modes
 
Old 12-28-2016, 10:37 AM   #1 (permalink)
Newb Techie
 
Sc00T's Avatar
 
Join Date: Oct 2016
Location: Colorado
Posts: 13
Question Scripting Rsync include and exclude

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.
Sc00T is offline   Reply With Quote
Reply

Tags
linux, osx, rsync, script

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HOW TO - Back up your data using Rsync and SSH. Jayce Linux and Open Source 9 08-05-2014 10:04 AM
Create rsync backups easily with the help of Gadmin-rsync Osiris Linux Tips and Tricks 0 12-26-2009 09:45 PM
command to exclude lines with specified text? office politics Linux and Open Source 3 11-13-2009 10:48 AM
Exclude Websites From Appearing In The Firefox Address Bar Osiris Tips, Tricks & Tutorials 0 09-02-2009 08:14 AM
File type to exclude from virus scanning pao_pao Microsoft Windows and Software 0 03-02-2006 09:56 PM


Our Communities

Our communities encompass many different hobbies and interests, but each one is built on friendly, intelligent membership.

» More about our Communities

Automotive Communities

Our Automotive communities encompass many different makes and models. From U.S. domestics to European Saloons.

» More about our Automotive Communities

Marine Communities

Our Marine websites focus on Cruising and Sailing Vessels, including forums and the largest cruising Wiki project on the web today.

» More about our Marine Communities


Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 05:43 PM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.