It is currently 10 December 2022, 6:21 Advanced search

System Management - delete temp files

Questions and answers on how to best use Instant Developer

System Management - delete temp files

Postby john w » 28 February 2022, 16:54

Is there a means by which I can delete temp files from the *temp/ directory of my application? I have tried doing when users end their session by adding the files to a temp file list, but some keep the session open indefinitely. This creates a build up of files in the *temp/ directory which I have to manually delete.

I would like to find a way to better manage the process. I am open to all suggestions.
Regards

John W
User avatar
john w
 
Posts: 714
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA

Re: System Management - delete temp files

Postby t.simoncini » 1 March 2022, 7:56

john w wrote:but some keep the session open indefinitely

If your users keep the session open indefinitely, I don't see any other solution than a manual delete.
Anyhow I wouldn't recommend keeping sessions up indefinitely. I planned a daily app pool recycle every night. It works fine.
t.simoncini
 
Posts: 1447
Joined: 5 March 2012, 14:00

Re: System Management - delete temp files

Postby john w » 1 March 2022, 16:31

I agree about the session being open. However, the business does not want to force people off, so it is periodically refreshing.

I need to look into app pool recycling that may at least help. Thanks for the suggestion!
Regards

John W
User avatar
john w
 
Posts: 714
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA

Re: System Management - delete temp files

Postby ljwilson » 4 March 2022, 18:34

I have applications where I use app pool recycling daily to not only clean up temp files but to get my master timer for server sessions on a nice 15 minute boundary (I typically have it run every 15 minutes to check on processes to launch, so this way I see in my log running at :00, :15, :30, :45). As long as I have the app pool restart at a time ending in one of those values that works for me (4:00 or 4:15 or 4:30 or 4:45 or...you get the idea).

But occasionally temp files hang around due to an app crash, or server shutdown, or...

I wrote this procedure to run daily using my master timer processes, though it could be called on app startup.

To test this app, put some files of various dates in your apps temp folder, then run the Delete Temp Files from the menu. For me I have it delete any files older than one day that are in the temp folder, but you could easily change those defaults.

Enjoy!

...jack
Attachments
Delete Temp Files Example.zip
(487.59 KiB) Downloaded 50 times
ljwilson
 
Posts: 678
Joined: 26 November 2013, 14:15

Re: System Management - delete temp files

Postby john w » 5 March 2022, 16:28

Jack - thanks I will take a look at the example and see what I can work into my application.
Regards

John W
User avatar
john w
 
Posts: 714
Joined: 24 October 2012, 16:29
Location: Apple Valley, Minnesota USA


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 10 guests

cron