I am using Solaris. I have several directories with the following names:
saa_first.data
saa_second.data
saa_third.data
I want to remove these directories along with its content, so I use:
rm -fr saa*
What I get is the following questions:
rm: examine files in directory saa_first.data (yes/no)? n
rm: examine files in directory saa_second.data (yes/no)? n
rm: examine files in directory saa_third.data (yes/no)? n
I don't get any error, but the directories are not deleted. What gives?
Here is my Solaris info:
$ cat /etc/release
Solaris 10 10/08 s10s_u6wos_07b SPARC
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
Use is subject to license terms.
Assembled 27 October 2008
UPDATE:
It works after I use the following command:
/usr/xpg4/bin/rm -fr saa*
I am still interested with the explanation why it didn't work with /usr/bin/rm
though.
You will most likely find that you have
rm
aliased torm -i
. If you had answered y to the question you would then have been asked to authorise the deletion of each file in each directory.You can temporarily remove the alias with the
unalias
command. If you want to permanently remove it you will have to find where in your shell initialisation files it is defined and remove it. Had you used the full path/usr/bin/rm
it would have worked the same as/usr/xpg4/bin/rm
I reckon this is due to files not being removed from those directories, henceforth the directories can't be deleted.
A more controlling way of doing this would be the following
This will make sure that it deletes files from those directories first, and then once the directories are empty it'll remove the directories themselves.
Isn't there a -d option on Solaris? On BSD, I would 'rm -dfr directory'. Check your man page :-)