mIRC Home    About    Download    Register    News    Help

Print Thread
#103945 27/11/04 06:42 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
i trying to clear out logs that are smaller then 1kb , but this one dont work :tongue: can somone see whats wrong with it?
Code:
alias clearslogs {
  var %l = $findfile($logdir,*.log,0)
  var %i = 0
  while (%l > 0) {
    var %f = $findfile($logdir,*.log,%l)
    if ($file(%x).size < 100) { .remove " $+ %x $+ " | inc %i }
    dec %l
  }
}


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#103946 27/11/04 06:45 PM
Joined: Dec 2002
Posts: 2,962
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 2,962
You assign each filename to %f but later refer to it as %x.


Spelling mistakes, grammatical errors, and stupid comments are intentional.
#103947 27/11/04 06:49 PM
Joined: Feb 2003
Posts: 3,432
S
sparta Offline OP
Hoopy frood
OP Offline
Hoopy frood
S
Joined: Feb 2003
Posts: 3,432
hadent noticed that.. but still no go.. so it have to be somthing more.. :tongue:


if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
#103948 27/11/04 07:52 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019

alias remlogs !.echo -q $findfile($logdir,*.log,0,remlog $1-).shortfn
alias -l remlog if ($file($1-) < [color:red]1024
) .remove $1-
[/color]
Change 1024 to whatever you want. Note that 1kb = 1024 bytes, and not 100.


Gone.
#103949 28/11/04 11:36 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Im sure 1kb is only 1000, isnt it? And I should know i work for a Seagate.

PS : this is a joke...

#103950 28/11/04 11:56 PM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Actually,

I didn't typo on 100. Look in his initial post, he says he wants to delete all files under 1 kb, yet he states if ($file(%x).size < 100)...

I own a Seagate, it's good, nice and quiet. smile

Greets


Gone.

Link Copied to Clipboard