SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
JAL script to purge older files

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
JAL script to purge older files
Author Message
nico



Joined: 08 May 2001
Posts: 13

Post JAL script to purge older files Reply with quote

I need to make a JAL script to delete files that are older than 10 days. I was wondering if somebody could give me a heads up on which JAL functions i should use to do this.

Thanks in advance,
-Nico

Fri May 25, 2001 4:25 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7948

Post Re: JAL script to purge older files Reply with quote

Use Dir to get the list of files and then use GetToken in a loop LoopUntil until the returned list is empty. For every file use FileDate and DateDiff. If the result of FileDiff > 10 use FileDelete. There are several examples in the on-line help that demonstrate how to do similar things. For example, you can check examples for LoopUntil statement.

: I need to make a JAL script to delete files that are older than 10 days. I
: was wondering if somebody could give me a heads up on which JAL functions
: i should use to do this.

: Thanks in advance,
: -Nico

Fri May 25, 2001 6:02 pm View user's profile Send private message
Marco B.



Joined: 11 Jun 2001
Posts: 1

Post Re: JAL script to purge older files Reply with quote

: Use Dir to get the list of files and then use GetToken in a loop LoopUntil
: until the returned list is empty. For every file use FileDate and
: DateDiff. If the result of FileDiff > 10 use FileDelete. There are
: several examples in the on-line help that demonstrate how to do similar
: things. For example, you can check examples for LoopUntil statement.

see this script file I wrote for the same job
:

Dim work_dir, string, "E:\\save_xfer\\"
Dim trig_file , string , "*.*"

dim ok , boolean
dim trig_name , string
Dim file_date , date
dim current_date , date
dim diff , number
dim test , boolean
dim log_msg , string

// file list:
// first file
concat(work_dir , trig_file , trig_file )
FileFindFirst( trig_file , trig_name, ok)
If( ok, process, end_job )

// process loop
process:

// non fa nulla per . e ..
IsEqual ( "." , trig_name, test )
ifThen (test , end_loop)
IsEqual ( ".." , trig_name, test )
ifThen (test , end_loop)

// compose file name (directory + file-name)
concat( work_dir , trig_name , trig_name)

// compare file date and file date
FileDate( trig_name , file_date )
Today( current_date )
DateDiff( file_date, current_date, diff )
// if greather then 15 -> delete
IsGreater( 15 , diff , test )
IfThen( test , no_del )
Concat( "File " , trig_name , log_msg )
Concat(log_msg , " Data " , log_msg )
Concat(log_msg , file_date , log_msg)
Concat(log_msg , " deleted " , log_msg)
LogAddMessageEx( "INFO", 4, "Pulizia Directory", log_msg )
FileDelete( trig_name )
no_del:

// end loop
end_loop:

// file list
// next File

FileFindNext( trig_name, ok)
If( ok, process , end_job )

end_job:
// comment

Mon Jun 11, 2001 9:25 am 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.