Only show one atime of 10 files

Old posts that have not been replied to for several years.
Locked
User avatar
Rusher2K
Halfop
Posts: 88
Joined: Fri Apr 18, 2003 10:45 am
Location: Germany
Contact:

Only show one atime of 10 files

Post by Rusher2K »

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 avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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 avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:catch catch catch
We've been through this before :P 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"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Damn, I tend to rush things and don't go directly to the source of things first.. :) Thanks for pointing that out (again) :mrgreen: 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 avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

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"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
Locked