SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
trying to do something...

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
trying to do something...
Author Message
nico



Joined: 08 May 2001
Posts: 13

Post trying to do something... Reply with quote

I'm trying to delete all files that are older than 10 days. The SysOp told me to use Dir to get the list of files then use GetToken in a loop LoopUntil until the returned list is empty. Then for every file use FileDate and DateDiff.

This is how far i've gotten (below). There are 2 things i don't understand. First, how do i construct a LoopUntil the GetToken returns empty. When I look into help for LoopUntil the first parameter is a boolean expression. Can somebody please tell me how I would write a LoopUntil my dir_str is empty? THanks.
and second, if it's running the GetToken until the string is empty, isn't it just going to keep replacing the value of my Dir in the return part of the LoopUntil function? Like my return_str variable. Won't it just keep getting overwritten? Doesn't seem very dynamic.

Thanks in advance,
Nico

Dim dir_str, string
Dim s1, string
Dim return_str, string

//Defined my comma seperator for the string to hold the file names
Set( s1, ",")

//Grabbing list of files in the dir
Dir( c:\\temp\*.*, dir_str )

LoopUntil( empty, done )

GetToken( s1, dir_str, return_str )

DONE:

//haven't programmed to this point yet :)


Tue May 29, 2001 8:35 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: trying to do something... Reply with quote

Dim( file_name, string )
Dim( file_date, date )
Dim( empty, boolean )
Dim( dir_str, string )
Dim( today, date )
Dim( days_old, number )
Dim( too_old, boolean )

Today( today )
Dir( "c:\\temp\\*.*", dir_str )
isEqual( dir_str, "", empty )

LoopUntil( empty, DONE )
GetToken( ",", dir_str, file_name )
Concat( "c:\\temp\\", file_name, file_name )
FileGetDate( file_name, file_date )
DateDiff( file_date, today, days_old )
isGreater( days_old, 10, too_old )
if( too_old, DELETE_IT, NEXT_FILE )
DELETE_IT:

FileDelete( file_name )
NEXT_FILE:

isEqual( dir_str, empty )
DONE:

: I'm trying to delete all files that are older than 10 days. The SysOp told me
: to use Dir to get the list of files then use GetToken in a loop LoopUntil
: until the returned list is empty. Then for every file use FileDate and
: DateDiff.

: This is how far i've gotten (below). There are 2 things i don't understand.
: First, how do i construct a LoopUntil the GetToken returns empty. When I
: look into help for LoopUntil the first parameter is a boolean expression.
: Can somebody please tell me how I would write a LoopUntil my dir_str is
: empty? THanks.
: and second, if it's running the GetToken until the string is empty, isn't it
: just going to keep replacing the value of my Dir in the return part of the
: LoopUntil function? Like my return_str variable. Won't it just keep
: getting overwritten? Doesn't seem very dynamic.

: Thanks in advance,
: Nico

: Dim dir_str, string
: Dim s1, string
: Dim return_str, string

: //Defined my comma seperator for the string to hold the file names
: Set( s1, ",")

: //Grabbing list of files in the dir
: Dir( c:\\temp\*.*, dir_str )

: LoopUntil( empty, done )

: GetToken( s1, dir_str, return_str )

: DONE: //haven't programmed to this point yet :)

Tue May 29, 2001 11:04 pm View user's profile Send private message
nico



Joined: 08 May 2001
Posts: 13

Post Re: trying to do something... Reply with quote

is FileGetDate only specific to 24x7 v3.0+ ?

because it doesn't turn 'green' when i type it into the JAL editor and when i try and validate it says 'keyword not found'.

P.S. i only have version 2.4.11 of 24x7, is there a possible workaround?

-Nico

: Dim( file_name, string )
: Dim( file_date, date )
: Dim( empty, boolean )
: Dim( dir_str, string )
: Dim( today, date )
: Dim( days_old, number )
: Dim( too_old, boolean )

: Today( today )
: Dir( "c:\\temp\\*.*", dir_str )
: isEqual( dir_str, "", empty )

: LoopUntil( empty, DONE )
: GetToken( ",", dir_str, file_name )
: Concat( "c:\\temp\\", file_name, file_name )
: FileGetDate( file_name, file_date )
: DateDiff( file_date, today, days_old )
: isGreater( days_old, 10, too_old )
: if( too_old, DELETE_IT, NEXT_FILE )
: DELETE_IT: FileDelete( file_name )
: NEXT_FILE: isEqual( dir_str, empty )
: DONE:

Wed May 30, 2001 3:07 pm View user's profile Send private message
nico



Joined: 08 May 2001
Posts: 13

Post Re: trying to do something... Reply with quote

Nevermind, I think you meant FileDate, thanks a million!

-Nico

: is FileGetDate only specific to 24x7 v3.0+ ?

: because it doesn't turn 'green' when i type it into the JAL editor and when i
: try and validate it says 'keyword not found'.

: P.S. i only have version 2.4.11 of 24x7, is there a possible workaround?

: -Nico

Wed May 30, 2001 3:12 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: trying to do something... Reply with quote

Sorry, for confusion, it meant to be FileDate. Also the second isEqual( dir_str, empty ) should be changed to isEqual( dir_str, "", empty )

: Nevermind, I think you meant FileDate, thanks a million!

: -Nico

Wed May 30, 2001 3:30 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.