mIRC Home    About    Download    Register    News    Help

Print Thread
/remove too weak. delete with $com, any better? #185647 12/09/07 09:19 AM
Joined: Jan 2005
Posts: 41
S
swgiant Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 41
/remove command is quite weak, then i want to ask any better to use $com to perform a deletion? then how to implement the codes? thanks...

Last edited by swgiant; 12/09/07 09:22 AM.
Re: /remove too weak. delete with $com, any better [Re: swgiant] #185652 12/09/07 10:39 AM
Joined: Aug 2006
Posts: 182
T
Thrull Offline
Vogon poet
Offline
Vogon poet
T
Joined: Aug 2006
Posts: 182
I imagine it can be done with $com statements, but why do you think /remove is "weak"?


Yar
Re: /remove too weak. delete with $com, any better [Re: Thrull] #185653 12/09/07 10:52 AM
Joined: Jan 2005
Posts: 41
S
swgiant Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 41
it cant remove certain of attributed files like read-only. i want to try $com, just maybe $com can perform like windows do...

Re: /remove too weak. delete with $com, any better [Re: swgiant] #185654 12/09/07 11:01 AM
Joined: Dec 2002
Posts: 3,547
S
SladeKraven Offline
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Until someone finds or comes up with a COM Objects solution, using the -b switch in the /remove call will remove read only files. But as stated in the help file:

The -b switch deletes the file and moves it to the recycle bin.

Re: /remove too weak. delete with $com, any better [Re: swgiant] #185658 12/09/07 12:02 PM
Joined: Sep 2005
Posts: 2,878
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,878
Code:
alias _remove { 
  var %obj = fso $+ $ctime, %file = $iif($nopath($1-) == $1-,$mircdir $+ $1-,$1-)
  .comopen %obj scripting.filesystemobject
  if (!$comerr) {
    if (!$com(%obj,DeleteFile,3,bstr,%file,bool,true)) { echo -ac info * /_remove: $iif(!$isfile(%file),the file does not exist.,the file is in use.) }
    else { echo -acq info * /_remove: removed $qt(%file) }
    .comclose %obj
  }
}


Same usage as /remove

Re: /remove too weak. delete with $com, any better [Re: hixxy] #185659 12/09/07 12:22 PM
Joined: Jan 2005
Posts: 41
S
swgiant Offline OP
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Jan 2005
Posts: 41
thanks... the $com delete command much powerful than /remove