I have a photorec folder from a data recovery process that has 2481 folders with the recovered files.The folder names are in the sequence recup_dir.1, recup_dir.2 ... recup_dir.2481I got a list of all extension in these folders with this command:find . -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -uSo I created another dir called photorecorg with a list of folders corresponding to each extension I got with the above command:mkdir 7z arj asf avi bat blend bmp bz2 cdr DOC docx flac flv gif gz html jpg mobi mov mp3 mp4 mpg ods odt ogg pdf php png ppt ps psd rar rtf svg swf tar tif ttf wav wmf xcf xls xlsx xz zipNow I need to copy the files in the photorec folder to the extension folders in photorecorg:I thought in something like find . -print | xargs cp $0 ../photorecorg/<extension>What would be the command that can find the files and copy to each extension dir ?
How to find and copy files based on extension?
find;filenames;cp;xargs
photorec='/pathto/your_photo_recovery_folder'photorecorg='/pathto/your_photo_recorg_folder'cd $photorec && \   EXTDIR=$photorecorg find . -type f -name '*.?*' -exec sh -c '      for f      do         dest=${EXTDIR}/${f##*.}         cp -p $f $dest/.      done   ' x {} +