Delete Directories Matching Path Recursively to a Specific Depth
find \
/Users/ihalvorson/Developer/tandem/tconnect/ios/Packages \
-name '*.build' \
-maxdepth 2 \
-type d \
-exec rm -rf '{}' ';'
/Users/ihalvorson/Developer/tandem/tconnect/ios/Packages
- The directory to search recursively (use .
if pwd)
-name '*.build'
- The name / pattern of the items to search for
-maxdepth 2
- The maximum depth to search
-type d
- The type of item to search for (in this case, directory)
-exec rm -rf '{}' ';'
- Execute rm -rf
on every item found (if looking for files and not directories, can use -delete
in place of this line)
Date
May 19, 2024