How to create a folder that cleans itself daily

Sometimes,we’d  like a temporary folder of sorts, in which we can put some files that we dont want to keep,or want to keep secret, and will be deleted on shut down/boot-up of computer or on a schedule.Today,we’ll  introduce to you one way to achieve the goal.(It might take a little effort, though.We recommend Only advanced users try it)

We can Use a cmd and Task Scheduler to create a folder that cleans itself daily

There are command line parameters for making and deleting directories (using “aka folders” for example).

md “C:\Users\Name\My Temp Folder”

to make the folder, and

rd “C:\Users\Name\My Temp Folder”

to remove the folder.

You can save these two commands in a batch file, and set it to run at a certain time each day using the Task Scheduler (or even at log in of a user…there are a lot of triggers you can set).(How to? We have just publish a article about “How to create automate tasks with Task Scheduler in windows 7)

Here is how to make a batch file:

Copy the first line of bold code given above, substituting your username in for “Name” (if your name is Bob on the computer, put Bob there, etc..). Paste the command into Notepad and look at it to verify that it is correct. Save it as Make Directory.bat

Then,  Once again, create a Remove Directory.bat, make sure everything is how you want it (it must have the same file location as before when you created it).

Now, double-click the Make Directory file you just saved. Your new folder should appear wherever you chose to create it (if you set it to create in your user folder, like Bob, it will be there). Now try the Remove Directory batch file. The file should now disappear. Simply create 2 tasks in the Task Scheduler (one to create, one to remove) to run the tasks whenever you want them to run (daily, I assume). For example, assuming you already have the folder there, set the Remove Directory to run at a certain time before you shut off the computer, then set the Make Directory to run right after. That way, the folder is deleted, then recreated…essentially “clearing” it like you wanted.

Or if youd like to keep the folder and not the files inside it’d look something like this
del c:\users\Name\desktop\temp\*.* /p
You can leave the switch off if you’d like for it to ask you for confirmation.