Found this answer here for copying files and keeping directory structure.copy filesfind . -name '*.xxx' -exec cp -iv --parents -t /path/to/target_dir {} +Is there an easy way to maintain the list of copied files and delete the files from the source directory?
copy mp3 to a target directory maintaining directory structure and deleting files when copy complete
linux;bash
Delete the files from the source directory usually translates to mv. Unfortunately mv does not have an option like --parent. The easiest solution with cp is probably: Call cp once for every file. Inefficient but easy to code:find . -type f \  -name '*.xxx' -exec cp -iv --parents {} /path/to/target_dir \; -deleteThe file is deleted if cp exits successfully. -delete may be specific to GNU find.