>all temporary dbfs are created using sys(2015). want to delete them all at application end. first i close all. then i tried "delete file _*.*", but that did not delete the files. then tried delete file with the full path name and _*.*, again that did not work. read the help on delete file and in one place it says you can use wildcards, but in the remarks it says you can not. any know how i can delete all the _ file?
>
>thanks - brenda
You may not be able to delete all these files if they reside on server (but then, why should they). They should be deleted right after they're not needed, i.e. if you have a temp dbf, before closing it remember its name (and the names of its indexes, if any):
select tempdbf
lcDbfName=dbf()
lcCdxName=cdx()
use
erase (lcDbfName)
erase (lcCdxName)
So you don't have dozens of them when you exit the app. In case of crash, or in case of running more than one instance of the app, you may have some which the system treats as still open, and they won't get deleted. My workaround was to have a directory dedicated to temp files (VFP's sortwork, tmpfiles, editwork and progwork also point to it), so in my shutdown .prg I purge them, like this:
ldYesterday=date()-1
if type("_work")="C"
for i=1 to adir(aa, _work+"*.tmp")
if fdate(_work+aa[i,1])
erase(_work+aa[i,1])
endif
endfor
endif
I assume that any stuck file won't remain stuck for more than 24 hours.