mIRC Home    About    Download    Register    News    Help

Print Thread
#8715 29/01/03 05:04 AM
Joined: Jan 2003
Posts: 237
X
xrn0id Offline OP
Fjord artisan
OP Offline
Fjord artisan
X
Joined: Jan 2003
Posts: 237
and is /rmdir <dir> for remove directory?



;Check for Life

if (%life == $null) {
goto getlife
}
Joined: Dec 2002
Posts: 77
B
Babel fish
Offline
Babel fish
B
Joined: Dec 2002
Posts: 77
/help /remove

Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
These questions are answered in the help file. see /help /remove, and /help /rmdir.

As for /rmdir, it cannot delete a folder with files in it. one solution for that, is to use a powerful yet dangrous DOS command called DELTREE:
Code:
//run -n command /c deltree /y [color:blue]folder[/color]

Note: folder name does not end up with a slash. otherwise, only files and sub directories will be removed, but the folder won't.

Another solution would be using $findfile to remove the existing files, then $finddir to remove sub directories, then /rmdir to remove the folder:
Code:
//!.echo -q $findfile([color:blue]folder[/color],*,0,remove $+(",$1-,"))
//var %i = $finddir([color:blue]folder[/color],*,0) | while %i { rmdir $finddir([color:blue]folder[/color],*,%i) | dec %i }
//rmdir [color:blue]folder[/color]

The reason why $finddir isn't used in the same way of $findfile, is because it's necessary to remove the most-depth sub directories before removing their parent folders. that's why a reverse loop is used.

Personally, I'd avoid using the DELTREE command when unnecessary, so I suggest you to try the scripted example first. worked here smile


Link Copied to Clipboard