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