This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Old posts that have not been replied to for several years.
Rusher2K
Halfop
Posts: 88 Joined: Fri Apr 18, 2003 10:45 am
Location: Germany
Contact:
Post
by Rusher2K » Mon Jan 26, 2004 11:25 am
Hello i want to write a scripts that delet all logs in my logs direktory what are older than 20 days bus when i use :
Code: Select all
!tcl foreach file ./logs/ { set time2 [file atime $file]; set time2 [ctime $time2] ;putserv "PRIVMSG $chan :$time2 " }
It only response one of the files
Code: Select all
Mon Jan 26 14:53:38 2004
<empty string> - clicks: 335
but why ?
And my log dir has some Sub-direktory`s how i let him fetch all direktory`s ?
Thx for Help
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Jan 26, 2004 12:25 pm
What made you think passing the string "./logs/" to 'foreach' would give you a directory listing?
Use '
glob ' to list files.
Have you ever read "The Manual"?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Jan 26, 2004 2:46 pm
For subdirs:
Code: Select all
catch { glob -type d <path>/* } dirs
and for files:
Code: Select all
catch { glob -type f <path>/* } files
Once the game is over, the king and the pawn go back in the same box.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Jan 26, 2004 2:56 pm
caesar wrote: catch catch catch
We've been through this
before There's no need to catch 'glob' ...use the -nocomplain option if you don't want errors when there's no matches.
Have you ever read "The Manual"?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Jan 26, 2004 3:51 pm
Damn, I tend to rush things and don't go directly to the source of things first..
Thanks for pointing that out (again)
I think I shall delete this old .tcl file cos makes me do bad things
Once the game is over, the king and the pawn go back in the same box.
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Mon Jan 26, 2004 4:05 pm
caesar wrote: I shall delete this old .tcl file cos makes me do bad things
Why not update it?
Have you ever read "The Manual"?
caesar
Mint Rubber
Posts: 3778 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Mon Jan 26, 2004 4:23 pm
Is/was an web page generator with the files of a dir.. umm.. duno, maybe cos I don't use it anymore..
Btw, nice eyes moving thing
Once the game is over, the king and the pawn go back in the same box.