>
> I worry about having a build script whose behavior can vary depending on
> whether it happens to find a file vs. a directory at runtime. I
> much prefer
> being fully explicit in task definitions, and not depending on detecting
> what is there to alter behavior. That's why Unix has an "rm"
> command AND an
> "rmdir" command, for example, so you have to be explicit on your
> intentions.
>
> John
>
Why shouldn't the same command work for both?
The "rm" command can be used to remove a directory as well as a file, but as
you point out it does require extra effort ("rm -R"). The same applies to
"cp" ("cp -R"). Worse, if you alias rm as "rm -i", you end up with a bunch
of "rm: descend into directory <dir>?" messages. So you have to escape
"rm -R", and then you don't even get a "Are you sure?" prompt.
View the files and folders in the file system as objects, then define
<copy>, <move>, and <delete> to function on objects. It shouldn't matter
what TYPE of object it is. The command should work the same, like in
Windows File Explorer or Midnight Commander.
-j
|