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 "." ?

5
  • please show your approach by answer
    – yael
    Commented Dec 8, 2016 at 15:32
  • 2
    @123: you don't need to escape .
    – cuonglm
    Commented Dec 8, 2016 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
    Commented Dec 8, 2016 at 15:45
  • @cuonglm oh yeah.
    – 123
    Commented Dec 8, 2016 at 15:46
  • @yael that's the best way, if your find supports -delete.
    – cuonglm
    Commented Dec 8, 2016 at 16:36

1 Answer 1

2

Now for another generic method:

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .