Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.How can I make a folder that clears itself daily?
#1
Posted 17 March 2010 - 07:14 PM
#2
Posted 17 March 2010 - 10:08 PM
There are command line parameters for making and deleting directories (aka folders).
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 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).
Here is how to make a batch file:
Copy the first line of bold code I gave you 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, copy the second line of bold code and paste it into a new Notepad window. Once again, make sure everything is how you want it (it must have the same file location as before when you created it). Save this as Remove Directory.bat
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.
How do you like that?
#3
Posted 19 March 2010 - 08:43 AM
del c:\users\Name\desktop\temp\*.* /p
You can leave the switch off if you'd like for it to ask you for confirmation.
Or you can try CCleaner.
This post has been edited by Scotty0844: 19 March 2010 - 08:51 AM
#4
Posted 19 March 2010 - 02:26 PM
#5
Posted 19 March 2010 - 02:32 PM
#6
Posted 19 March 2010 - 02:44 PM
del "C:\Users\Jesse\Desktop\Daily Delete\*.*"
it worked, buy there was no way i tried it that worked with the /p switch. what am i doing wrong?
#7
Posted 19 March 2010 - 02:47 PM
This post has been edited by keyboardNinja: 19 March 2010 - 02:48 PM
#8
Posted 20 March 2010 - 01:11 PM
#9
Posted 26 March 2010 - 03:44 PM
gorydragon, on Mar 20 2010, 11:11 AM, said:
Instead of /p try /q. Be careful though since this will delete blindly so make doubly sure your del command is correct!
#10
Posted 15 April 2010 - 01:57 AM
del C:\Users\Jesse\Desktop\Daily Delete\*.* /qcorrect?
#11
Posted 15 April 2010 - 08:42 AM
#12
Posted 03 May 2010 - 08:12 PM
the only thing i noticed is it only deletes files, if i put a folder of files in it it doesnt delete the folder or its contents.
i tried a second line like this
del C:\Users\Jesse\Desktop\Daily Delete\*\*.* /q
but it didnt work. can i do something else like this?
#13
Posted 03 May 2010 - 10:59 PM
That will delete the Daily Delete folder.
This post has been edited by strolln: 03 May 2010 - 11:04 PM
#14
Posted 03 May 2010 - 11:18 PM
Create the folder with the batch file...delete the folder with the batch file. No need for switches, asterisks, etc...to pick up every file extension and/or directory.
#15
Posted 04 May 2010 - 12:17 PM
RD /S /Q C:\Users\Jesse\Desktop\Daily Delete
Use this to create it again:
MD C:\Users\Jesse\Desktop\Daily Delete
How to run the batch files at startup/shutdown :
Run gpedit.msc, goto Settings > Windows Settings > Scripts > Shutdown/Startup
Add the script files.

Help


Back to top













