1
rsync -av --files-from=list.txt A/* B/

Inside the list.txt I have

A/text1.txt

When executing the command, I get an error refering me to the man page, does anyone know why?

Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation See http://rsync.samba.org/ for updates, bug reports, and answers rsync error: syntax or usage error (code 1) at options.c(854)

2

You're confusing rsync by including directories on the command line and in the file, and by having the wildcard. This may be more what you want:

$ cat lists.txt 
text1.txt

$ ls A
text1.txt  toskip.txt

$ rsync -av --files-from=lists.txt A/ B/
building file list ... done
created directory B
text1.txt

sent 89 bytes  received 31 bytes  240.00 bytes/sec
total size is 0  speedup is 0.00

$ ls B
text1.txt

So lists.txt only includes the filenames and not the directory, and on the command line you specify the source directory A. We can see it only copied the file listed in the lists.txt file and skipped the other one.

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.