Lots of programs leave files in temp folder, if they are not shut down properly. I don't think cleaning this up should be the responsibility of your standard business application; perhaps of some maintenance application that is run once a day or once a week. Or, the user cleans up those files occasionally. It is more important for you to check that there is sufficient free disk space. This is something I do on startup.
On the other hand, if you want to make sure you are in the correct directory, check curdir() or perhaps better fullpath("") (includes disk letter), before actually deleting.
>Hi all
>
>Help please,
>
>I get The data path in the project start.
>oApp.startdir=network\data\..
>set defa to (oApp.startdir)..
>
>Now I want to delete entire files of temp directory (only files, not directory) on local computer.
>
>I use with the following code:
>
local nloop,cfilename,cOutput
>Local array aFiles(1)
>cOutput='c:\tmpfox\'
>set default to (cOutput)
>nFiles=adir(aFiles)
>If nFiles>0
> for nLoop=1 to nFiles
> cFilename=cOutput+aFiles[nLoop,1]
> delete file (cFilename)
> endfor
>Endif
>set default to (oApp.startdir)
>return .t.
>I afraid about any unexpected problem that will cause the 'set defa to local' to fail and the user will delete thr real data.
>Thank's
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)