I recently had a hard drive that got accidentally reformatted and had to resort to third party software to recover the files. The files have been recovered, but they are nested within multiple folders such as:
Media/Mediatype/wmv Files/11-08-2014/recovered files/image.jpg.
Each file is contained in something similar. I was wondering if there was a simple Mac OSX terminal option that basically goes deep into each and every folder path and extracts it all into one folder according to filetype? Thanks!
How about this?
find . -type f -name "*.jpg" -print0 | xargs -0 -I {} mv {} ./jpg/
You can change the "*.jpg"
to other file types and create a folder for them and move those files too. Example:
find . -type f -name "*.doc" -print0 | xargs -0 -I {} mv {} ./Documents/
Or if you don't want to create specific folders at all and just want all those files into one folder, then:
find . -type f -print0 | xargs -0 -I {} mv {} ./allfiles/
and finally, you can use the following command to remove the other empty directories.
ls -1 | grep -v allfiles | xargs rm -rf