The Blog

Archive files and folders in Linux Posted on

ASSERT: No files have newline characters in them. Spaces, however, are AOK.

# TEST FIRST: CREATION OF FOLDERS
find . -type f -iname \*.mov -printf ‘%h\n’ | sort | uniq | xargs -n 1 -d ‘\n’ -I ‘{}’ echo mkdir -vp “/TARGET_FOLDER_ROOT/{}”

# EXECUTE CREATION OF EMPTY TARGET FOLDERS
find . -type f -iname \*.mov -printf ‘%h\n’ | sort | uniq | xargs -n 1 -d ‘\n’ -I ‘{}’ mkdir -vp “/TARGET_FOLDER_ROOT/{}”

# TEST FIRST: REVIEW FILES TO BE MOVED
find . -type f -iname \*.mov -exec echo mv {} /TARGET_FOLDER_ROOT/{} \;

# EXECUTE MOVE FILES
find . -type f -iname \*.mov -exec mv {} /TARGET_FOLDER_ROOT/{} \;

This entry was posted in Linux. Bookmark the permalink.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *



CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code