5

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
Stefan Lasiewski
  • 23,667
  • 41
  • 132
  • 186
user1781482
  • 151
  • 1
  • 1
  • 3

3 Answers3

18

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
Brian
  • 796
  • 1
  • 6
  • 15
1

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

find . -name .DS_Store -printf \"%p\"\ \  | xargs rm -v
gareth_bowles
  • 9,127
  • 9
  • 34
  • 42
0

The print parameter can be used to show all matched files:

find . -print