Linux Commands

Some useful commands that I’ve found/have been shown to me.

Use find to find all files that are not underneath folders named something specific (used for finding duplicates on Synology not in the @eaDir folders). Capitalization of the file extension matters.

find . -type d -name @eaDir -prune -o -name "*.jpg" -print

Used with rmlint:

find . -type d -name @eaDir -prune -o -name "*.jpg" -print | rmlint - -O sh:output.sh

Also, grep can be used with an “exclude”:

find . -type f | grep -v @eaDir

The one downside for large file sets is that prune stops looking down that tree whereas grep filters after the searching.

How to find all file extensions using find and awk. Not perfect and I haven’t looked into how it works, but it does something.

find . -type f | awk -F. '!a[$NF]++{print $NF}'

Special thanks to Eric Lien and Chris Greenley for guiding me on my journey.

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.