Skip to content

Instantly share code, notes, and snippets.

@T-Rave
Created June 30, 2019 02:50
Show Gist options
  • Save T-Rave/ac209d030cffe296e3d2d03e9c23ce52 to your computer and use it in GitHub Desktop.
Save T-Rave/ac209d030cffe296e3d2d03e9c23ce52 to your computer and use it in GitHub Desktop.
Lazy person media copy
# Bash command to find multiple media types and copy them to a new destination while retaining directory structure
## remove the parent flag on the cp if you want all found files to be moved into a single directory. Note, may lead to barking about duplicate files
## adjust the size value as needed. + is > value, - is < value, only value will match exactly. Not having this may lead to small sprite images
## using -iname allows for case insenitive search
## starts at current location and searches recursively within
find ./ -type f \( -iname \*.jpg -o -iname \*.png -o -iname \*.jpeg -o -iname \*.psd -o -iname \*.mov -o -iname \*.avi -o -iname \*.mpg \) -size +80k -exec cp --parents {} /<path to copy to>/ \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment