rm -rf not able deletes file but not the directory

i am trying to remove a directory using rm -rf command but its not getting removed.. it doesnt throw any error also.. i am logging as the owner of the dir and removing it but still no luck.. i am able remove a file but not a directory.

i am using solaris 10

Have you even tried to look at the output of:

?

yes checked :slight_smile: bt can you tell me if i am going wrong somewhere

This is a good example:
rm man page

Then on your system, check

post the output of ls -l from the dir where you are trying to remove the files + the COMPLETE command and the output.

btw. "rm -rf *" will remove dirs also!

test$ ls -l
total 0
drwxr-xr-x  2 xxx  staff  68 10 Dez 23:01 test
drwxr-xr-x  2 xxx  staff  68 10 Dez 23:01 test1
drwxr-xr-x  2 xxx  staff  68 10 Dez 23:01 test2
drwxr-xr-x  2 xxx  staff  68 10 Dez 23:01 test3
test$ rm -rf *
test$ ls
test$

i am getting the below error when i used rm -r dirname

rm: cannot determine if this is an ancestor of the current working directory
1 Like

rm is confused as to whether you are removing a directory that is part of the present working directory. check to see if there is a link or something that is causing this.

i created a test directory and created few more dir with it and few files with those created directories..

and when ran rm -rf testdir it removed all files present with the it .. but the sub dir where still present and the same error is thrown

Maybe this will help, try this:

Running UNIX Solaris 10 mount point permissions are important

1 Like

well my mount point has 770 permission and i logged in as the owner of the mount point and tried rm -rf dir it throwed the same error

and also to be noted.. rm -rf works for file but not for dir.

and when i execute rm -rf directory it removes all files under that dir but leaves the sub directories .. it doesnt remove dir.. but removes files..

later i tried to by coming out of that mount point.. and then gave the ful path of the dir to be deleted then.. i could remove it..

would be nice if someone has some explanation for this

That's strange. Could really use some details about the environment you're doing this on though..

What filesystem type is it that you see this behavior on?

Does it behave that way in other parts of the system or with other users, or just in the directory structure which you're working, or as a particular user?

Is the filesystem local or remote?

What OS/Vers?

solaris 10 .. OS is installed with zfs file system.

but the mount points are vxfs . the issue is with 4 new mount points that are created with 770 permissions..

it works fine for root user.. but for other users including the mount point owner has the issue.

files are removable but not directory.. and to be noted.. an empty dir can which doesnt have any sub directory in it can be removed but if the dir contains some sub dir it cannot be removed.

its a local file system only

This thread has a lot of good info on that:

<ack, I can't post urls yet>

Just do this google search and it's the top link: probably rm rf solaris

I wonder if the umask in your /etc/profile is something more restrictive than default? It would be interesting to log in the owner, open up his umask, move the directory, move it back, then run the rm -rf command again.