Skip to content

Instantly share code, notes, and snippets.

@joshuacerbito
Last active January 3, 2022 19:13
Show Gist options
  • Save joshuacerbito/be6ac34145e56102991fd822652b9903 to your computer and use it in GitHub Desktop.
Save joshuacerbito/be6ac34145e56102991fd822652b9903 to your computer and use it in GitHub Desktop.
Recursively find (and delete) all files of the same type in current directory
# Recursively find all files of the same type in current directory
find . -name "*.bak" -type f
# Recursively find and delete all files of the same type in current directory
find . -name "*.bak" -type f -delete
# Print out a list of directories to be deleted:
find . -name 'node_modules' -type d -prune
# Delete directories from the current working directory:
find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment