Some thoughts on recursive deletion
Unix has three situations:
+-------------------------------+---------+
| Delete all files | rm * |
+-------------------------------+---------+
| Delete all directories | rmdir * |
+-------------------------------+---------+
| Recursively delete everything | rm -r * |
+-------------------------------+---------+
There is no "-R" or "-r" option for rmdir.
I believe DOS has something similar (DEL and DELDIR, or something
like that).
As a user, I would be comfortable with a similar set of
functionality.
I would suggest that there be a "recurse" flag AND separate
commands for files and directories.
If I have the following in a directory:
% mkdir d1 d2 d3
% touch f1 f2 f3
% ls
d1/ d2/ d3/ f1 f2 f3
I would like to be able to remove all of the current files
without changing my directory structure. This is like "rm *".
If you decide to depart form the current pattern, I would
suggest that the file "rmFile -R *" ONLY remove files, so
my directory heirarchy stays in place.
+--------------------------------------+-------------+
| Delete all files | rmFile * |
+--------------------------------------+-------------+
| Recursively delete files, but not | rmFile -r * |
| directories | |
+--------------------------------------+-------------+
| Delete all directories in current | rmDir * |
| directory | |
+--------------------------------------+-------------+
| Recursively delete empty directories | |
| (start at bottom so a directory that | rmDir -r * |
| only has empty dirs gets deleted | |
+--------------------------------------+-------------+
To delete EVERYTHING, you would need to execute two commands:
% rmFile -r *
% rmDir -r *
However, I think Unix-like behavior would be safer than a
delete everything.
David
> Stefan wrote:
> > In case of the delete task I'd really prefer to have an distinction
> > between dir and file because of the damage one could do by accident -
> > only alternative I see is a recurse attribute with default false.
>
> Hmm, this sounds like a good idea, IMHO. That is the way the UNIX/Linux
> commands work:
>
> rm -R /home/ernst/tmp
> ls -R
> chmod -R a+r *
>
> So I'd say don't distinguish between files and directories, and just add
> an attribute `resursive' or `recurse' and set the default value to
> `false'.
>
> A +1.01 vote for me :)
>
>
> Ernst
-------------------------------------------------------------------
David Hunter Elrod Rivendell Technologies, Inc
[EMAIL PROTECTED] 1111 W. El Camino #109, PMB348
http://www.rivendell.com Sunnyvale, CA 94087-0126
Voice: 650/254-1790 Fax: 650/254-1792