Rsync Exclude Folder Extra Options not working

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
So I have tried multiple configurations trying to exclude a folder from being copied during a rsync task. Currently my Extra Options look like this,

--password-file=/mnt/v01/rsync --exclude="/mnt/v01/Data/Backup/"

I am trying to have rsync backup my Data folder, but exclude the Backup folder. I have been looking all over the internet trying different configs people have suggested but nothing seems to work. What am I missing here? Can I not have two statements in the Extra options, one for the password file the other for the exclude statement? I tried to hit enter in the box to put them on different lines but they seem to just go back to the format above, that was a direct copy and paste.
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
According to the rsync man page, the --exclude option takes a PATTERN, not a FILE, so you probably want something more like
--exclude=/mnt/v01/Data/Backup/**
 

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
Looks like that didn't work :( It's still backing up folders I don't want synced.
 

Bidule0hm

Server Electronics Sorcerer
Joined
Aug 5, 2013
Messages
3,710
IIRC I used a relative path instead of an absolute path when I excluded folders/files.

For example if you rsync a folder folder_a to a folder folder_b with two sub-folders sub_folder_a and sub_folder_b and you want to exclude sub_folder_b then the command should be: rsync --exclude=sub_folder_b /the_path/folder_a/ /another_path/folder_b/
 

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
Well tried the above method as well, still nothing is working in Freenas. Is it possible that you can't have two statements in the gui box where you point to the password for rsync in a file and try to exclude something.. for some reason I could have sworn this was working before. Maybe I need to open a bug case.
 

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
From my /etc/crontab file,

00 00 * * * rsync PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/root/bin" /usr/bin/lockf -s -t 0 -k "/mnt/v01/Multimedia/" /usr/local/bin/rsync -r -t --delete-delay --delay-updates --password-file=/mnt/v01/rsync --exclude=/mnt/v01/Multimedia/TV\ Shows/ "/mnt/v01/Multimedia/" "rsync"@192.168.1.6::"Multimedia" 2>&1 |/usr/bin/logger -t rsync

to me everything looks ok.. not sure why this wouldn't work.
 

Kuro Houou

Contributor
Joined
Jun 17, 2014
Messages
193
Well I think I figured it out. It looks like I shouldn't have been giving it the full path to the folder I didn't want synced. For example /mnt/v01/Multimedia/TV Shows. I tried just doing --exclude=TV\ Shows/ and it looks like its working now :)
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778

enemy85

Guru
Joined
Jun 10, 2011
Messages
757
Goodmorning,
first of all sorry to re-open this thread, but I have a similar problem and maybe you could help me to solve it.
I backup my windows PCs to my freenas box, using deltacopy SERVER module on the PCs and letting the FN rsync module doing the all job as PULL (i decided to set my system this way, because was easier and i was able with the delete checkbox option, to delete files in destination directory that didn't exist anymore in my pcs)
I created a dataset on my nas for every pc and everything works perfectly, but now i have the need to backup just specific folders of my pc.
Is there a way to do this without being obliged to create a single rsync task and dataset for every folder?
I read about the "--exclude=path i want to exclude" to insert in the extra option box, but i guess this won't work with a windows path, or at least i can't understand what path should be.

thanks in advance
 

enemy85

Guru
Joined
Jun 10, 2011
Messages
757
to partially answer my own question, the only suitable method i found so far, is the create a "exclude.txt" file to place onto my freenas box and then add in the "extra option" box in the rsync module
"--exclude-from=/mnt/pathwhereisplacedthetextfile/exclude.txt"

the only problem is to create manually the txt list with every folder we are not interested into.

does anybody know if there is a similar command but with the opposite function to rsync just selected folders? I've tried "include" as written somewhere, but it keeps rsyncing all the folders
 

Robert Trevellyan

Pony Wrangler
Joined
May 16, 2014
Messages
3,778
I believe what you need to do is exclude everything, then include what you want. I say this based on my understanding of the FILTER RULES section of the rsync man page.
 

enemy85

Guru
Joined
Jun 10, 2011
Messages
757
I believe what you need to do is exclude everything, then include what you want. I say this based on my understanding of the FILTER RULES section of the rsync man page.

thank you for the reply,
according to all the tests i ran in order to sort out a solution for this problem, it seems to me that the best way is to do as you suggested too. In order to achieve this goal, i used the
"--include-from=FILE.txt"
option and wrote a txt file that i saved on my nas, that looks like this:

+ desktop
+ desktop/**
+ pictures
- *

NOTE: the secret is to add the "- *" in order to tell rsync to exclude everything else, unless it will copy everything the same.
NOTE_2: the "/**" means that rsync will copy every subfolder/file in the main folder
Hope this would save someone else some test time! :)
 

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
IIRC I used a relative path instead of an absolute path when I excluded folders/files.

For example if you rsync a folder folder_a to a folder folder_b with two sub-folders sub_folder_a and sub_folder_b and you want to exclude sub_folder_b then the command should be: rsync --exclude=sub_folder_b /the_path/folder_a/ /another_path/folder_b/


Hi,

I tried this & it worked very well - thank you. If i want to exclude another folder, do i just put a space, then the path?

--exclude=olddata/ /newerdata/

Assuming I want to exclude Olddata and newerdata?

Thanks,
Rich
 
Top