|
#1
| |||
| |||
| Recursive rm w/ wildcard? Want to do recursive rm w/ a wildcard, deleting all files named, for example, *.jpg, but leaving others, going all the way down inside a folder/directory. Tried variations on .... rm -r *.jpg Not allowed? Another approach? tia |
|
#2
| ||||
| ||||
| find . -name "*.jpg" | xargs rm YMMV and it will break for file with spaces in their names, the space case is left as an exercise for the reader. |
|
#3
| ||||
| ||||
| Also you may want to check it with xargs -n 1 echo as a sanity check. |
|
#4
| |||
| |||
| I am pretty sure that command should work, maybe try it with a capital R |
|
#5
| |||
| |||
| rm -fR /*.jpg <enter> yep.
__________________ ---------------------------- chris@chornbe.com http://learntomac.blogspot.com/ http://motorcyclemanifesto.blogspot.com/ |
|
#6
| ||||
| ||||
| That will not get /foo/bar.jpg The thing to remember is that the shell does the * expansion (globbing) and not rm. So you are always saying recursively remove these directories. Not recurse through these directories looking for these files. |
|
#7
| ||||
| ||||
| rm -rf [filenames] rm -rf *.jpg
__________________ Mac OS X User for life ![]() "You know what is worse than being all alone in the night, captain? To be all alone in the crowd." - Ambassador Delenn |
|
#8
| ||||
| ||||
| at root / sudo rm -Rf *.jpg Bad things can happen, watch out. |
![]() |
| Thread Tools | |
|
|