Firstly, check what command you are using. If that is rm
command or rmdir
command. Since the error is "rm: cannot remove 'Ancestry info': Is a directory"
, you might be probably using the rm
command. But to delete a directory, we must use rmdir
The above can be used instead of:
Also, the directory has to be empty in order to delete it in Linux.
By this, your problem should be solved. If no, then there is some issue with the file/directory permissions. To remove a file, user needs write "w"
and access "x"
permission on the directory.
It does not matter how the file's permissions (or ownership) are set. Any user with "w"
on the directory can delete any file in the directory. Without "w x"
on the directory, a user will not be able to delete any file in the directory or the directory itself.
To check the user permissions, use the command:
To change the permission, use chmod
command. Here let us consider that only you want the permission of the file or directory. So, "- r w x r - - r - -"
permission will be enough.
Where "r w x"
is user permission to read, write and execute the file. Next "r - -"
, "r - -"
is permission for group and other respectively. For them, only read permission is enough.
To change the user permission, we use
$ chmod 744 Ancestry info
$ chmod u=rwx Ancestry info
Hopefully, this will solve your problem.