Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to question
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
How to question
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01131752
Message ID:
01131752
Views:
64
I have a routine that runs once a day to check for a new file to import, after I import that file, I create a backup copy and store it in the same directory. I want to only keep the last four of of those files, so whenever my routine runs, after I create the backup copy, I want to delete all but the last four. The filenames for the backup start with the character I and then the datetime() the backup was created. How do I sort the results of adir() command by the first element (filename). Once I have the array in the right order, I can just loop through, starting on the 5th one and delete the files. Below is what I was trying, but it doesn't sort it in decending order. I think I'm missing something in the asort.


Thanks
lnFiles=ADIR(laBackFiles,'i*.dat')
ASORT(laBackFiles,1,1,1)
? laBackFiles[1,1] && I20060623113811.DAT
? laBackFiles[2,1] && I20060623115915.DAT
? laBackFiles[3,1] && I20060623123535.DAT
Next
Reply
Map
View

Click here to load this message in the networking platform