I have navigated to a specific directory on the file system and wish to delete all files within the directory that contain 'sofa_' in their file name.
Can someone please suggest how this can be done?
If all files are in the same directory (no subdirectories) just run:
rm *sofa_*
If you need this to descend into subdirectories, either use find
:
find . -name "*sofa_*" -type f -delete
Or, if you are using bash
, enable the globstar
option which makes **
match all files and 0 or more subdirectories (making it recursive):
shopt -s globstar
Then:
rm **/*sofa_*
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments