4

I have a directory which contains hidden files and by that I mean, not just the files whose name starts with . but also the files whose name contains ~ character at the end like somefile.txt~.

I want to delete only those files (the remaining files need to be unaffected) in an efficient way.

How I can achieve that with a single command ?

Ubuntu 14.04 Trusty Tahr.

Vicky Dev
  • 433

1 Answers1

3

Not really one single command, but why make it more complicated than necessary?

find -type f -name ".*" -delete; rm *~

The first command removes all files starting with . and the second one all ending with ~

Wayne_Yux
  • 4,873