Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: How do I know if I can delete a file/folder?

by mitd (Curate)
on Jul 26, 2002 at 05:36 UTC ( #185432=note: print w/replies, xml ) Need Help??

in reply to How do I know if I can delete a file/folder?

This simple answer is you, that is you the owner of the process which is attempting to delete the file, must have 'write permissions' on/for that file.

The definition of 'write permissions' is one of the following:

  1. you are the file owner and the file has owner write permission set.
  2. you are a member of the file's group and the file has group write permissions set
  3. The file has other write permissions.

The same rule apply to directories with addtional condition that the directory must be empty.


Holy Dumbus Old Fartus! why an old fart should not be
allowed to touch the keyboard past midnight.

After a well deserved 'slap upside the head' from grep and others.

Please ignore the above the only excuse I can offer is 1969 bad drugs.

Repeat after me: File deletion operations are Directory operations and therefore depend on directory ownership and mode settings

mitd-Made in the Dark
'Interactive! Paper tape is interactive!
If you don't believe me I can show you my paper cut scars!'

  • Comment on Re: How do I know if I can delete a file/folder?

Replies are listed 'Best First'.
Re: Re: How do I know if I can delete a file/folder?
by grep (Monsignor) on Jul 26, 2002 at 15:17 UTC


    As I tried to politely explain in a /msg to mitd a file delete is a directory operation. The file permissions are not a factor. You need directory write permissions to delete a file in *nix

    If you are still unsure please check these links

  • Permissions - By Rutgers Univ.
  • An Introduction to Unix Permissions - By
  • File and Directory Permissions
  • CHMOD on
  • To quote from the site:


    Another interesting thing to note is that lib/ which is a directory has permissions, too. Permissions take a different meaning for directories. Here's what they mean:

    • read determines if a user can view the directory's contents, i.e. do ls in it.
    • write determines if a user can create new files or delete file in the directory. (Note here that this essentially means that a user with write access to a directory can delete files in the directory even if he/she doesn't have write permissions for the file! So be careful with this.)
    • execute determines if the user can cd into the directory.

    Just me, the boy and these two monks, no questions asked.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://185432]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (10)
As of 2018-03-23 19:22 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (296 votes). Check out past polls.