Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to delete temp files

Status
Not open for further replies.

143Aroul

Programmer
Jul 17, 2003
16
FJ
Hi

I have written a project in VB/MS-Access for the report used crystal report 8.5. The project is working fine.

my problem, when execute the program in the backend it creates lot of .tmp files in the root directory (c:\) and it is not deleting after closing my program.


Anyone can help me out

 
Hi,

How about using the FileSystemObject (refernced using Microsoft Scripting Runtime) to loop through all of the files in C:\ and Kill() all of the .tmp files created since the program was opened??

There may be a worry that if any other programs that are open write .tmp files to the same directory that the above method would Kill() them to, but if nothing else was running (or writing .tmp files to the C:\ root) it should work fine. However that would be something to test before implementing a solution like the above.

Hope this helps.



Harleyquinn
 
What dictates the location where these temp files are created? could you not have them created in the temp folder (they'll then be deleted by the OS).

Everybody body is somebodys Nutter.
 
I have had the same problem, I have never been able to figure out what is creating these temp files or why.....


 
I prefer this over KILL...

Function Deletefile(FilePath)
Dim fso As FileSystemObject
Set fso = CreateObject("Scripting.FileSystemObject")
fso.Deletefile (FilePath)

End Function


Just put this into a module and when you execute the loop simply call the function like this

Deletefile("c:\windows\temp\" & filename)

"Filename" is a varible which contains the filename in which you wish to delete. You can make the path a variable as well and take care of mulltiple locaitons while you are at it.

LF
 
For anyone interested the following hotfix fixed this for me in version 9.


Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top