2 thoughts on “Introduction to a Find Loop in Bash

  1. John Scancella August 16, 2018 / 7:27 am

    You could also just have find execute it for you instead of redirecting to a loop:

    find “/Path/To/My-Folder” -iname “*.wav” -exec bwfmetaedit –MD5-Embed –reject-overwrite “{}” \;

    Like

  2. Great write-up, but beware this will go wrong for files with names that contain whitespace characters. Some solutions are given here:

    https://stackoverflow.com/questions/7039130/iterate-over-a-list-of-files-with-spaces/

    I usually go for something like this myself (lines 94-101):

    https://github.com/KBNLresearch/tikadetect-tree/blob/master/tikadetect-tree.sh

    Note that this actually goes through $rootDir recursively; if you don’t want recursion just leave out the -r flag at the start of the loop.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s