Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot create program workspace temp files
Message
 
 
À
28/07/2014 05:57:50
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01603693
Message ID:
01604815
Vues:
59
>>Finally found th e reason for my problem:
>>
>>The TEMP dir (%TEMP%) had too many files. I deleted files and all is working fine again.
>>
>>Which leaves as question:
>>
>>How can I automatically delete unnecessary files without "disturbing" programs that rely on one of that files?
>
>Call this on exit:
>
PROCEDURE PurgeTemp
>* 4/9/2001 dragan
>
>	LOCAL lcDir, lcFSpec, lcFsp, lcOnErr, ldDay
>	LOCAL N, aa[1], i
>	lcDir=SYS(2023)
>	lcFsp="*.*"
>	lcOnErr=ON('error')
>	ON ERROR *
>	ldDay=DATE()-3
>	lcFSpec=FORCEPATH(lcFsp, lcDir)
>	N=ADIR(aa, lcFSpec)
>	FOR i=1 TO N
>		IF aa[i,3]<ldDay
>			ERASE (FORCEPATH(aa[i,1], lcDir))
>		ENDIF
>	ENDFOR
>	ON ERROR &lcOnErr
>
>
>The three day limit is to avoid any files which may still be open by some process. If it's in the temp folder and older than three days, I assume it's safe to delete. If it's still used by something, it most probably can't be deleted anyway.
>
>However, this doesn't clear the subfolders below %temp% - but these don't get created daily. They usually crop up only when some software is updated or installed. I delete them manually.

I think ON ERROR is so 90s :). Wouldn't be better to enclose the ERASE with TRY/ENDTRY without CATCH?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform