0

I need to remove all the files under /tmp that contain the "." or dot character

so I created the following

find /tmp -name "*.*" -delete

please advice if this is the best approach to remove the files that contain "." ?

  • please show your approach by answer – yael Dec 8 '16 at 15:32
  • 2
    @123: you don't need to escape . – cuonglm Dec 8 '16 at 15:41
  • hi cuonglm please advice if you think about better syntax , i also not sure what is better to use delete or rm ? – yael Dec 8 '16 at 15:45
  • @cuonglm oh yeah. – 123 Dec 8 '16 at 15:46
  • @yael that's the best way, if your find supports -delete. – cuonglm Dec 8 '16 at 16:36
2

Now for another generic method:

 find /tmp -type f -name '*.*' -print0 | xargs -0 rm -f

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.