1

I have a directory, named data, with multiples files in it which have different types of permissions. I want to delete only the files that do not have any permissions, i.e shown as ---------- in ls -l. My guess is to use the find command, but I don't know where to start.

What one line command can do this ?

6

1 Answer 1

4

The find command you are looking for is this:

find /path/to/data -type f -perm 000 -delete

Caution: First run the above command without -delete to make sure that it lists the correct files.

  • -type f lists files only.
  • -perm 000 lists items without permissions only (000 is "no permissions" in octal mode).
  • -delete deletes the found items.

See man find for more options.

0

You must log in to answer this question.

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