Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete Files older than a certain Filename?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01444235
Message ID:
01444237
Views:
64
>I have a direcectory of tables, one for each month (yyyymm.dbf), which I need to cycle through and delete all those older than 30 days.
>
>SYS(2000) would let me cycle through all files in the directory and check if each one is older than the 30 days but this seems a very inelegant way of solving this.
>
>Can anyone think of a cleaner way of achieving this?

You could use ADIR() to get an array of *all* the files in the folder; by default they're sorted alphabetically ascending, so you could just spin through the array deleting the topmost file(s) until anything older than your 30 day threshold is deleted.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform