Mac OS find files using regex
Posted: 02/12/14
If you want to find files of a certain type (extension) within a directory, and nested directories, the following Terminal bash command works perfectly on the latest versions of OSX:
find -E . -iregex '.*\.(type1|type2|type3)' -exec commandYouWantToExcuteOnTheFile {} \;
This will match anything.type1, anything.type2, anything.type3
Replace "commandYouWantToExecuteOnTheFile" with the executable and attributes you want to run against each file found.
{} is the notation for the selected file, so place this wherever your required executable expects the file path or -input attribute to be.
Keywords for this post: mac, osx, find, bash, script, files, type, regex, terminal
Popular categories:
Recent posts:
- ADB device driver won't install
- Eclipse: An error has occurred. See the log file .metadata/.log
- Updated blinkbox iPad app
- Nexus 7 doesn't appear in adb devices list
- Improve the keyboard in the Samsung ICS update
- 403 Forbidden error on Mac web server
- Getting error with manually created NIB?
- Adding/removing items from PATH on Mac
- Presenting at Flash Oxford
- Failed to get the task for process xx
- more...
Publications:
Places you'll find me:
Archive:
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023