Remove directories in Solaris

rmsolaris

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.

Best Answer

You will most likely find that you have rm aliased to rm -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.

$ alias rm
alias rm='rm -i'

$ rm -r tmp1
rm: examine files in directory tmp1 (yes/no) y
rm: remove tmp1/1 (yes/no) y
rm: remove tmp1/2 (yes/no) y
rm: remove tmp1: (yes/no) y

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

Related Topic