Delete old files

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Delete old files

Post by rullbandspelare » Tue Dec 20, 2005 8:59 am

Hi!
I want to delete *.wl files that is older than a week ( to save space and speed up indexing of the content from another program )

The script never executes the Else statement for some reason. I have files in the range of 9 days old.

Any help is appreciated - Thanks>


GetFileList>\\bud\worklist\bud\*.wl,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>file_names_%k%,file_names_%k%
EndIf
Label>save
Until>k,file_names_count

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Dec 20, 2005 9:40 am

Hi,

Your script should look like this:


GetFileList>\\bud\worklist\bud\*.wl,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>file_names_%k%,file_names_%k%
EndIf
Until>k,file_names_count


Or simplify it to:


GetFileList>\\bud\worklist\bud\*.wl,files
Separate>files,;,file_names
Let>k=0
Repeat>k
Let>k=k+1
IfFileChanged>file_names_%k%,>7
//delete the file
DeleteFile>file_names_%k%
EndIf
Until>k,file_names_count
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts