Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you delete oldest Directories?
Message
From
12/05/2009 02:36:18
 
 
To
12/05/2009 02:25:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01399335
Message ID:
01399336
Views:
72
You can use ADIR() to find all the directories, use the D switch to only get the directories.
lnNumberOf Directories=adir(laDir,'c:\temp','D')
Then you use asort() to find the oldest directory. Check message#1399322 to see how to remove a directory.

>I have programmed a backup of current databases into dated Directories - for example (FX_May15) (FX_May2)
>What i would like to do is limit the number of backups to 10 and delete the oldest directories.
>
>Can someone help me out here. All i have to go on is code to count files. Added problem is that VFP9 will not delete directories that contain files.
>
>Code for counting files
>lnFileCount = Adir(laFiles, "C:\temp\*.dbf")
>If lnFileCount > 10
>????
>endif
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform