RSync, Copy all images but not directory structure
Andrew Mclaughlin
I'm trying to copy all images from many subdirectories into one folder without the current folder structure.
Example:
product/v/9/v9315.jpg
product/v/9/v9316.jpg
product/v/9/v9317.jpg
product/v/9/v9318.jpg
product/v/9/v9319.jpgI just want
/images/v9315.jpg
/images/v9316.jpg
/images/v9317.jpg
/images/v9318.jpg
/images/v9319.jpgI've tried the following but it doesn't work:
rsync -rt --include "*/" --include="*.jpg" --exclude="*" root@IP:/var/www/dir/media/catalog/product/ . --dry-run --progressAny help would be great.
1 Answer
Try using the find command to list all the files, then pipe them to rsync --files-from like:
find ./product/ -type f -regex ".*[.]jpg" |
rsync -t --no-R --files-from=- . images/The --no-R flag makes the files go in "images/" instead of subdirectories.