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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.