>>VFP6 I have code to delete all the files in a folder greater than some number of days ago. But I also want to delete the folders that were created > than some number of days ago. How to do?
>>
>>
>>arraynum=ADIR(aTemps,ctables)
>>FOR i = 1 TO arraynum
>> if atemps(i,3)+20 < DATE()
>> cFile=aTemps(i,1)
>> DELETE FILE (cpath+cFile)
>> endif
>>ENDFOR
>>
>
>Anybody come up with an answer for this. Just looking at my code and I have not solved this problem yet.
In addition to what others suggest, try using the FileSystemObject to delete folders, and all the files with in.
oFS=CREATEOBJECT("scripting.filesystemobject")
oFolder= oFS.GetFolder("c:\temp2")
FolderDate=ff.DateLastModified()
if DATE()-TTOD(FolderDate) >= 20
oFolder.Delete(.T.)
endif
Greg Reichert