Delete extension-specific files using logic

This was taken from my own notes amassed over several years. Commands
like these are a real time-saver.

A lot of people, I imagine, will probably use `-exec rm {} \+` which is
fine and all, but it's another process you'd have to launch, which
isn't necessary at all, unless you need certain `rm` functionality.
pull/79/head
terminalforlife 5 years ago
parent 8e5e9dd0a4
commit 86007dd5db

@ -53,3 +53,6 @@ find . -iname '*.txt' -exec vim {} \+
# Find all files with extension '.png' and rename them by changing extension to
# '.jpg' (base name is preserved)
find . -type f -iname '*.png' -exec bash -c 'mv "$0" "${0%.*}.jpg"' {} \;
# Use logic and grouping to delete extension-specific files.
find \( -iname "*.jpg" -or -iname "*.sfv" -or -iname "*.xspf" \) -type f -delete

Loading…
Cancel
Save