Skip to main content

Some bash commands I find useful

find . -type f -name "*.nfo" -o "*.edl" -delete

find . -type f -name "*.nof" -o "*.edl" -exec mv {} /path/to/ \;

-o flag indicates logical OR. \; bit is a delimiter to -exec flag indicating the bash exec ends there.

# iterate through subdirectories 
for dir in */; do
  # enter the subdirectory
  cd "$dir" || exit 1 # exit if cd fails
  find . -type f -name "*-*" -exec sh -c 'mv "$0" "${0//-/ }"' {} \;
  cd ..
done

{} is a placeholder for find passing current file name to sh.