Originally posted by: tony.evans
Yes. The -r means recursive removal, which means the rm commands go down each directory from the start point until it gets to the bottom and then deletes the content and moves back upwards. The * is a wildcard (in essence) which is expanded by the shell to every matching filename. Since * in shell terms means 'anything', then every file and directory in the top level directory is passed to the rm command.
So, in a directory with,
drwx------ 2 bob staff 512 31 Jul 2006 backups
drwx------ 2 bob staff 512 03 Jul 2008 bin
-rw------- 1 bob staff 164409 19 Jul 2007 catalog.mic
When you type rm -r *, the * gets expanded to backups bin catalog.mic so the command that actually gets executed is,
rm -r backups bin catalog.mic
The rm command isn't interpreting the *, the shell expands it first before passing the results to the command.
rm -r c* would expand to,
rm -r catalog.mic
for example.
It's worth reading up on the Korn Shell (which is the default shell under AIX) to see how file expansion works, it's your friend and extremely powerful.
There are other ways of building lists of files if you wanted to include or exclude certain values, but shell expansion is pretty flexible.
You could get used to using -i with rm, which prompts you before each file / directory, but if you have thousands it'll take a while!
#AIX-Forum