mIRC Homepage
Posted By: HigherDragon New Commad[Removing things] - 09/10/03 03:06 AM
I think it would be very useful for mIRC to be able to delete directorys with file names in them.
/rmdir only deletes folders without files in them.
*Which is pretty lame? Why would you want to delete a folder with nothing in it? It would be best to be able to remove whole foldes with things in them?*
Posted By: KingTomato Re: New Commad[Removing things] - 09/10/03 03:36 AM
/imtoolazy {
var %dir = $1-
var %a = $findfile(%dir, *.*, 0, remove $shortfn($1-))
/rmdir %dir
}

/imtoolazy_part2 {
var %dir = $1-
/run cmd /c del /Q /S $shortfn(%dir) $+ *.*
}
Posted By: codemastr Re: New Commad[Removing things] - 09/10/03 03:44 AM
First off that's not a limitation of mIRC, that's a limitation of any sane operating system. A directory is not a file, deleting a directory is different than deleting a file. Therefore the operations should not be mixed. Furthermore, why exactly would you ever want to delete an entire file and its contents without actually prompting the user? Seems like the only reason to do that would be to delete files without letting the user know...
Posted By: qwerty Re: New Commad[Removing things] - 09/10/03 08:32 AM
You may find this useful.
Posted By: CtrlAltDel Re: New Commad[Removing things] - 09/10/03 11:56 AM
Since you're only doing this on your own computer (aren't you??) what's the problem with typing
/run explorer.exe path\to\the\folder\
I see no reason for mirc to emulate windows explorer
Posted By: pheonix Re: New Commad[Removing things] - 09/10/03 12:30 PM
Code:
alias rmdir {
  if ($1 == -r) {
    if (!$exists($iif("*" iswm $2-,$2-," $+ $2- $+ "))) { return }
    if ($input(are you sure you want to delete $2- and everything in it?,owd,warning) != $true) { return }
    .echo -q $findfile($iif("*" iswm $2-,$2-," $+ $2- $+ "),*.*,0,remove $+(",$1-,"))
    !rmdir $iif("*" iswm $2-,$2-," $+ $2- $+ ")
  }
  else {
    if (!$exists($iif("*" iswm $1-,$1-," $+ $1- $+ "))) { return }
    !rmdir $1-
  }
}


/rmdir -r "c:\filepath"
Posted By: DekuHaze Re: New Commad[Removing things] - 09/10/03 12:31 PM
Linux is sane and lets you delete the directory and all its contents, but only if you specify a recursive deletion (rm -dr <dir>). Hasn't proved to be a problem, as far as security warnings go smile

I think it's a valid suggestion. I was going to suggest it myself after reading the thread in mIRC Help, if it wasn't here already. laugh
Posted By: pheonix Re: New Commad[Removing things] - 09/10/03 12:36 PM
Quote:
I think it's a valid suggestion.


newbie idiot: so i just load your script?
idiot: yep.
newbie idiot: it says run initializing settings, what should i click?
idiot: yes
newbie idiot: it's deleting my c: drive shocked
idiot: laugh
Posted By: DekuHaze Re: New Commad[Removing things] - 09/10/03 12:40 PM
Newbie should run his Windows box without being an administrator user all the time. Perhaps newbie should be renamed "idiot" wink

On the other hand, perhaps a "Do you really want to delete <whatever>?" dialogue should pop up or something laugh
Posted By: Rich Re: New Commad[Removing things] - 09/10/03 01:40 PM
You have to remove all subdirectories as well:
Code:
alias imlazy {
  var %dir = $1-
  var %a = $findfile(%dir, *.*,0,remove $shortfn($1-))
  var %b = $finddir(%dir,*,0,rmdir $shortfn($1-))
  rmdir $shortfn(%dir)
}
© mIRC Discussion Forums