Deleting and recreating the Temp folder automatically
Started by gldisk
Deleting and recreating the Temp folder automatically 08 February 2021, 04:38 |
Registered: 4 years ago Posts: 8 |
I am using SoftPerfect RAM Disk so that it saves the contents to an .img file that contains the Firefox browser profile and the user's Temp folder.
Is there a way to delete and recreate the Temp folder on each reboot without having to place it in a volatile RAM disk?
Thank you.
|
Re: Deleting and recreating the Temp folder automatically 08 February 2021, 08:34 |
Admin Registered: 11 years ago Posts: 1 004 |
RAM disk .img files are used for non-volatile (persistent) data, but in this case the data is purposefully kept instead of being automatically deleted. So the scenario you are asking about, where a folder is created for permanent data storage and yet gets automatically deleted, seems quite unusual. That's why I'd like to clarify what you require this for.
Normally, if someone is using their RAM disk only for temporary data that they don't need to keep for future work, they want it to be volatile, and therefore they don't need an image file at all. Without an image file, the RAM Disk application works faster, and decreases reads and writes from the physical disk even further.
To get a Temp directory automatically created on a RAM disk, open the disk settings, and specify the Temp folder name in the File System Options - Create Folders section. You can add more than one folder to that list (type each name on a separate line), and use those folders for different purposes. They will all be automatically created each time together with the RAM disk, will be available to the system and other software during the working session, and then will be deleted together with all their contents every time you reboot or switch your computer off. That is, they will be volatile.
There may be a solution for your scenario if you use two different RAM disks: a volatile disk for Temp, and a persistent disk for Firefox profile.
Another way is to use a batch file for clearing out the Temp folder:
@echo off cd /D %temp% for /d %%D in (*) do rd /s /q "%%D" del /f /q *What this does:
- turns the command display off for the whole running script;
- changes the working directory of the batch file to the path from the %temp% system variable;
- deletes directories recursively, with all files and subdirectories, and without asking for confirmation;
- removes read-only files while skipping the prompts.
Re: Deleting and recreating the Temp folder automatically 10 February 2021, 04:22 |
Registered: 4 years ago Posts: 8 |
The Firefox profile takes up about 150 MB, but the RAMdisk size should be at least twice that amount of space for future needs.QuoteAnn
Is there a particular reason why you want to create a temporary folder in a non-volatile image file and then automatically delete it each time?
The user's Temp folder have varying space requirements depending on what data is put inside it.
Instead of creating a 300MB RAMdisk for Firefox and a 1GB RAMdisk for the Temp folder, I prefer to create only 1GB one, and pay attention on how the Temp folder grow in size, because not all programs delete the files created inside it, hence the need to delete and recreate it.
Can I use the SoftPerfect RAM Disk built-in AutoRun function to run .bat scripts like this ?QuoteAnn
Another way is to use a batch file for clearing out the Temp folder ...
|
Re: Deleting and recreating the Temp folder automatically 10 February 2021, 08:29 |
Admin Registered: 19 years ago Posts: 3 611 |
Re: Deleting and recreating the Temp folder automatically 18 February 2021, 20:52 |
Registered: 4 years ago Posts: 8 |
|
Re: Deleting and recreating the Temp folder automatically 19 February 2021, 10:42 |
Admin Registered: 19 years ago Posts: 3 611 |
Re: Deleting and recreating the Temp folder automatically 19 February 2021, 21:28 |
Registered: 4 years ago Posts: 8 |