Sephiroth
http://sephiroth.scifi-action.de/board/

/remlogs
http://sephiroth.scifi-action.de/board/viewtopic.php?f=4&t=78
Seite 1 von 1

Autor:  Sephiroth [ 15. Juni 2008 20:17 ]
Betreff des Beitrags:  /remlogs

alias remlogs {
  ; /remlogs 2w
  ; /remlogs -h <time> for quiet removal (won't show the files removed)
  ; removes all logs older than 2 weeks (last modification!)
  if ($1 == -h) { !set %¿ = $true | !tokenize 32 $2- }
  !set %% $duration($1-)
  if (%% !isnum 0- $+ $ctime) { !unset %% | !return }
  !set %½ 0 | !set %¼ 0 | !set %¾ 0
  !echo $color(info) * Removing logs from $qt($logdir) (older than $duration(%%) $+ )
  if (%% isnum 0- $+ $ctime) {
    %% = $ctime - %%
    %% = $findfile($logdir,*.log,*,d $file($1-).mtime $1-).shortfn
  }
  echo 3 -ag * $iif(%½,%½,No) files removed ( $+ $bytes(%¾).suf $+ ). $iif(%¼,(Unable to remove %¼ files.))
  !unset %% %½ %¼ %¾ %¿
}
alias -l d {
  if (%% >= $1) {
    !var %size = $file($2).size,%longfn = $longfn($2)
    !.remove $2-
    !inc %¾ %size
    %size = $bytes(%size).suf
    !inc %½
    if (!%¿) {
      !echo 9 -ag * Removed: %longfn ( $+ %size $+ )
    }
  }
  !goto end
  :error
  if (!%¿) { !echo 4 -ag * Unable to remove file: $longfn($2-) ( $+ $bytes($file($2-).size,k).suf $+ ) }
  !inc %¼
  !reseterror
  :end
}

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/