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.jpg I just want
/images/v9315.jpg /images/v9316.jpg /images/v9317.jpg /images/v9318.jpg /images/v9319.jpg I'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 --progress Any 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.