0

This command:

rm -rf "$HOME/.quicklock/locks/"*

does seem to remove files or folders in the locks directory, which start with "."

how can I remove those files too? Any other filenames that would fail to be removed given that command?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

2 Answers2

1

You can use a clever combination of wildcards to avoid . and ..:

rm -fr .??*

would be one of them, which works if you don't have any files or directories that are only 2 characters long (like .x for example).

rm -fr .[!.]*

does that job better.

muru
  • 72,889
Francisco
  • 188
0

I got a suggestion to do this:

rm -rf "$HOME/.quicklook/locks";
mkdir -p "$HOME/.quicklock/locks";

should work, I guess.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
  • 1
    of course invites race conditions if other processes expect "$HOME/.quicklock/locks" to always exist, but nothing that mkdir -p can't solve if I just use that command elsewhere. – Alexander Mills Apr 20 '18 at 01:39
  • SO and SE Unix/Linux is not a forum board where you go and add a comment on previous comment it works like question and answers kind of thinkg –  Apr 20 '18 at 01:52
  • sorry I don't follow...I add comments to my answers all the time – Alexander Mills Apr 20 '18 at 02:00