In the OS X terminal I am using the follow rsync
command to transfer some source folders to the destination.
rsync -vrl --files-from=/Users/myname/Desktop/myFiles.txt / /Users/Mynames/Desktop/DestFolder
And these are the files that are being transferred (listed in myFiles.txt):
/users/myname/Downloads/downloaded-files1
/users/myname/Downloads/downloaded-files2
/users/myname/Downloads/downloaded-files3
The copy process is completed without errors.
The problem is on destination folder I get full paths like bellow.
/users/myname/Downloads/downloaded-files1
/users/myname/Downloads/downloaded-files2
etc..
I want only the last part /downloaded-files1.
What options should be passed to place the files in the destination directory that is specified on the commandline?
If you just want the files, with any directory structure flattened, then you can simply add the --no-relative
option to your command.
If you want to preserve any directory structure, then you need to form your command like this:
rsync -vrl --files-from=/Users/myname/Desktop/myFiles.txt /users/myname/Downloads/ /Users/Mynames/Desktop/DestFolder
And use this as your list:
downloaded-files1
downloaded-files2
downloaded-files3
Rsync uses the source directory for the "root" of the files copied.