Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 369
  • Last Modified:

how remove all temporary files created by program

Hi.
In the application I working now with creates same amount of temporary files. Is it any way to delete them when the program close.
Thank you
0
mastiSoft
Asked:
mastiSoft
  • 3
  • 3
  • 2
  • +1
1 Solution
 
mindgardenerCommented:

sure..that is possible..can you give some detail about what programming language are you using, and some details on the environment ?

how is the log file created ? do you programmatically create them ?

you can check this link http://msdn.microsoft.com/en-us/library/ms162135(v=sql.90).aspx

mindgardener
0
 
CodeCruiserCommented:
In my programs, I declare following in a module

Dim TempFiles As New List(of String)

Then I have a method

Public Function GetTempFile(ext As String) As String
     Dim TempFile As String = IO.Path.GetTempFileName()
     Dim FileName As String = IO.Path.GetDirectoryName(TempFile) & IO.Path.GetfileNameWithoutExtension(IO.Path.GetTempFileName()) & ext
     TempFiles.Add(FileName)
     Return FileName
End Function


Note that this function adds each temp file to tempfiles list. Then in main form closing event, I have

For each file in TempFiles
     IO.File.Delete(file)
Next
0
 
mastiSoftAuthor Commented:
Hi.
I use VB net 2010. I created list before but the application really big and temporary files creates in big amount in different part of application. Add files to some list feel no\t OK.
0
Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

 
CodeCruiserCommented:
> Add files to some list feel no\t OK.

Do you have any other idea in your mind?
0
 
mastiSoftAuthor Commented:
I don't know. I don't think this is only we that don't wank left garbage in user's PC.
0
 
CodeCruiserCommented:
>I don't think this is only we that don't wank left garbage in user's PC.

Did you mean

I don't think this is only way to not leave garbage in user's PC.

???
0
 
cupCommented:
Do you have access to all the code or only your bits?

If you have access to all the code, are you allowed to change the code anywhere or is there a demarkation where you have to raise requests for other sections to do the same?

Apart from using GetTempFile, does any other part of the code create temporary files by using a different technique?

Is all the code written in VB or is some written in some other language which have their own way of creating temporary files?
0
 
cupCommented:
Do you have a global try catch which tidies up, even when the program crashes or is it one of those amazing programs that never crashes?  I've seen a few of these before - they don't crash no matter what you throw at them.
0
 
mastiSoftAuthor Commented:
Sorry for late response.
I have access to all parts of the code and temporary files generates in several places. Of course I can create some path list , but I was thinking maybe there is a better way to solve this problem.
It seems that is not.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now