I'm trying to batch move/organize a large number of files (.jpg) from nested subdirectories to a relative directory. The structure is pre-planned. Just not 100% sure what the most efficient and safest way to do it is.
Sample structure:
/directory/subdir/jpg/
/directory/subdir/source/something.jpg
/directory/subdir/source/something.tif
/directory/subdir/source/something-else.jpg
/directory/subdir/source/something-else.tif
/directory/subdir/source/another-file.jpg
/directory/subdir/source/another-file.tif
/directory/another-subdir/jpg/
/directory/another-subdir/source/yet-another-file.jpg
/directory/another-subdir/source/yet-another-file.tif
Goal is to get it to this...
/directory/subdir/jpg/something.jpg
/directory/subdir/jpg/something-else.jpg
/directory/subdir/jpg/another-file.jpg
/directory/subdir/source/something.tif
/directory/subdir/source/something-else.tif
/directory/subdir/source/another-file.tif
/directory/another-subdir/jpg/yet-another-file.jpg
/directory/another-subdir/source/yet-another-file.tif
I thought about something like this. Just not sure if it's going to toast my structure. We're talking about tens of gigs of data, and thousands of files that are critical to our client's organization.
find /directory -name \*.jpg -exec mv {} ../jpg/ \;
If there's some form of "dry run" anyone might know about that I can use to visually test before actually executing, that'd be amazing. Thank you!
UPDATE:
Actually, I'm now trying to do the same thing locally on my Mac, and getting this error. Any clever workarounds?
$ find -name "*.jpg" -execdir pwd \; -execdir echo mv -v '{}' ../jpg \;
find: illegal option -- n
usage: find [-H | -L | -P] [-EXdsx] [-f path] path ... [expression]
find [-H | -L | -P] [-EXdsx] -f path [path ...] [expression]