Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Temp files cleanup
Message
From
25/09/2003 09:32:08
 
 
To
24/09/2003 21:52:16
John Tomblin
Service Station Systems, Inc.
San Jose, California, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00832068
Message ID:
00832222
Views:
24
Why do you need to change directories at all?
clear
? sys(2003)
Tempdir = SYS(2023)
=ADIR(Temps,Tempdir+"\*.tmp")
FOR Ctr = 1 TO ALEN(Temps,1)
    IF TYPE('Temps(Ctr,3)') = "D" .AND. Temps(Ctr,3) < DATE()
        ERASE (Tempdir+"\"+Temps(Ctr, 1))
	? "Deleted: "+Tempdir+"\"+Temps(Ctr, 1)
    ENDIF
ENDFOR
? sys(2003)
>Foxpro is not very effective at cleaning up temp files. The temp files folder acquires more and more files over time. I have written a proc to clean up the temp folder upon entering my app. It looks like this:
>
>ApprDir = sys(5) + curdir()
>Tempdir = sys(2023)
>cd (TempDir)
>FileCnt =adir(Temps)
>on error X = .T.
>
>for Ctr = 1 to FileCnt
> erase (Temps[Ctr, 1])
>endfor
>
>cd (AppDir)
>
>The "on error" line is just to prevent the display of errors if a file is in use. This code does not work. I am always left in the temp folder not the application folder.
>
>Any ideas?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform