0

I want to do rsync from the folder e.g. /user/home/ford , and I have a directory named xthp inside ford; so now i want to exclude few of the files from the directory xthp.

I am using the command given below:

rsync -vax --exclude-from=/user/home/ford/xthp/excld.txt /user/home/ford/ destination-path

The files I want to exclude are listed in excld.txt but I am not able to do this.

  • Are the file names newline separated in excld.txt ? Also are you copying to the same filesystem? – heemayl Feb 10 '16 at 6:28
  • Yes, files are new line separated and same type of file system. Within the excld.txt , I wrote like: sng.dat, then in new line, fkg.dat ..... – J. Singh Feb 10 '16 at 6:34
  • Use absolute paths, not relative paths.. – heemayl Feb 10 '16 at 6:36
  • I am using absolute paths only ! – J. Singh Feb 10 '16 at 6:44
  • Can't reproduce.. – heemayl Feb 10 '16 at 6:56
1

Yes This is correct your command not working -vax:

I just tried with:

rsync -vax --exclude-from=/var/www/html/exclude.txt /var/www/html/test/ /var/www/html/test/

My exclude.txt example file are like below:

- /var/www/html/.git
+ /var/www/html/*.php

Or

.git

app/

Here is your command modified just give try with it:

rsync -vax --exclude-from=/user/home/ford/xthp/excld.txt /user/home/ford/ destination-path

More at exclude-from

Output:

rsync -vax --exclude-from=/var/www/html/exclude.txt  /var/www/html/test/ /var/www/html/test
sending incremental file list
./

sent 104,153 bytes  received 624 bytes  209,554.00 bytes/sec
total size is 153,940,108  speedup is 1,469.22
  • A leading "+" means include the pattern. A leading "-" means exclude the pattern.
  • rsync: failed to open exclude file /user/home/ford/xthp/excld.txt: No such file or directory (2) rsync error: error in file IO (code 11) at exclude.c(1062) [client=3.0.6] – J. Singh Feb 10 '16 at 9:35
  • could you please check like rsync -avz --exclude-from=/var/www/html/exclude.txt /var/www/html/test/ /var/www/html/test it's ok here ...sending incremental file list..sent 397,400 bytes received 2,784 bytes 800,368.00 bytes/sec – Ramesh Chand Feb 10 '16 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.