So I use these command on my storage server to clean up some junk, but it doesn't produce any output or result. I found the syntax online somewhere and just modified for which files I need it. What else do I need to add to see what is actually being deleted or total at the end? Ultimately this would be a script that will run automatically but for right now I'm running the commands manually. Thanks in advance!

find . -name .DS_Store -printf \"%p\"\ \  | xargs rm 
find . -name ._.DS_Store -printf \"%p\"\ \  | xargs rm 
find . -name Thumbs.db -printf \"%p\"\ \  | xargs rm
find . -name ._Thumbs.db -printf \"%p\"\ \  | xargs rm
  • 4
    Is anything wrong with just changing rm to rm -v? – MadHatter Feb 18 '13 at 16:36

find also has a -delete flag. And you could also combine everything into one command, possibly saving some time:

find . \( -name .DS_Store -or -name ._.DS_Store -or -name Thumbs.db -or -name ._Thumbs.db \) -print -delete
| improve this answer | |
  • 4
    find -print -delete is really the best way to do it. – R. S. Feb 18 '13 at 17:33

Just add the -v parameter to the rm command for verbose output, e.g.

find . -name .DS_Store -printf \"%p\"\ \  | xargs rm -v
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.