Home rsync: Sync all files to single directory, ignoring directory structure

# rsync: Sync all files to single directory, ignoring directory structure

user4599
1#
user4599 Published in September 20, 2018, 12:50 pm

I would like to sync all files to a certain directory without syncing the directory structure.

So far, I have this:

rsync -vcr --remove-source-files --exclude='*sample*' --exclude='*Sample*' --include='*/' --include='*.avi' --include='*.mkv' --include='*.mp4' --include='*.wmv' --exclude='*' $src1$src2 \$dest


That seems to be working fairly well, but if one of the included file types are in a sub-directory of the source directories, the parent directories will also be transferred.

To sum it up, I want all included file types to be moved straight to the single destination directory, WITHOUT copying the parent directory structure.

• Possible duplicate of Rsync make flat copy – Ruslan Osmanov May 8 '16 at 5:30