Re: Fwd: [PHP] Recurs Directory Delete

From: Date: Fri, 14 Jul 2006 23:34:53 +0000
Subject: Re: Fwd: [PHP] Recurs Directory Delete
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-239497@lists.php.net to get a copy of this message
Andrew Kreps wrote:
[forwarding my response to the list, as the reply function didn't quite work] Actually, that's not true. 'rm -rf' removes all files, directories and subdirectories. Microsoft's del has no analogy to that (although there was a deltree command in older versions of DOS). You still have to manually (or programmatically) iterate through the directory structure and run 'del *.*' and then 'rd directory' in every single subdirectory to achieve the same result that the single command 'rm -rf' gives you on UNIX-like systems. On 7/14/06, Adam Zey <azey@nit.ca> wrote:
So? Windows has this thing called the "del" command that does the same thing as "rm". Regards, Adam.
Sure it does. I logged into a Win2K box and got help for rmdir/rd: C:\>rmdir /? Removes (deletes) a directory. RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path
    /S      Removes all directories and files in the specified directory
            in addition to the directory itself.  Used to remove a directory
            tree.
    /Q      Quiet mode, do not ask if ok to remove a directory tree with /S
It seems like "rmdir /S /Q <directory>" is exactly identical to "rm -rf <directory>". It deletes a directory tree (the -r), and doesn't prompt or display anything (the -f). So, yes, this *CAN* be done on Windows. Sorry if I was wrong about del originally, but my point stands, Windows is not entirely crippled when it comes to the shell :) Regards, Adam.

« previous php.general (#239497) next »