: 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
|