mIRC file cleaner

By co2h on Oct 28, 2007

This snippet allows you to remove excess files right from your mirc. It opens up a new window based on the type of file you specify, or just all files. You have the option to remove all files (if a specified type, of that type) or just remove a single file through menu or input commands. Please see the documentation for further details.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;   mIRC cleanup - co2(h)
;       Snippet opens up a new window and lists either a specified type of file or all files in your mirc directory. 
;       You have the ability to remove one file, or all files of your selection. 
;   Syntax:
;       /filter (-(filetype))
;       Examples:
;               /filter -ini -> opens up the new window and lists all ini files in your mirc directory.
;               /filter -> opens up the new window and lists every file in your mirc directory.
;       When in the snippet:
;               type: remove*<filename> to remove a file
;               Or just use the menu commands. They are a bit easier.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias filterfile { 
  if ($1 && $left($1,1) iswm $chr(45) && $right($1,-1) isalpha) {
    var %x = 1
    if ($window(@file)) window -c @file
    window -bl15ek @file  
    set -e %acchar $remove($1,-)
    while $findfile($mircdir,$+(*,.,$remove($1,-)),%x) { 
      aline -l @file $nopath($v1)
      inc %x
    }
  }
  else { 
    var %x = 1
    if ($window(@file)) window -c @file
    if (%acchar) unset $v1
    window -l15eb @file  
    while $findfile($mircdir,*.*,%x) { 
      aline -l @file $nopath($v1)
      inc %x
    }
  }
}

menu @file { 
  dclick:clear -p @file | filter -fw $shortfn($findfile($mircdir,$+(*,$sline($active,1),*),1)) @file
  remove: editbox -p @file $+(remove*,$sline($active,1))
  view:clear -p @file | filter -fwp $shortfn($findfile($mircdir,$+(*,$sline($active,1),*),1)) @file 
  remove all:remallfiles
}

on *:input:@file:{ 
  if ($gettok($1,1,42) iswm remove && $isfile($gettok($1,2,42)) && $left($1,1) != /) { 
    remove $shortfn($findfile($mircdir,$+(*,$gettok($1,2,42),*),1))
    dline -l @file $sline($active,1).ln
    clear -p @file
  }
}

alias -l remallfiles { 
  clear @file
  var %x = 1
  while ($findfile($mircdir,$+(*,.,$iif(%acchar,$v1,*)),%x)) { 
    remove $shortfn($v1)
    dline -l @file %x
  }
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.