Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Delete file _*.* not working
Message
From
23/10/1998 16:18:20
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00148653
Message ID:
00150000
Views:
17
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform