Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
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.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

How can I make a folder that clears itself daily?


  • Please log in to reply
15 replies to this topic

#1 gorydragon

gorydragon

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 17 March 2010 - 07:14 PM

I'd like a temporary folder of sorts, in which i can put downloaded files that i dont want to keep, and will be deleted on shut down/boot-up of computer or on a schedule. Thanks!

BC AdBot (Login to Remove)

 


#2 keyboardNinja

keyboardNinja

    Bleepin' Ninja


  • Members
  • 4,815 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:teh interwebz
  • Local time:09:26 AM

Posted 17 March 2010 - 10:08 PM

Hmm...I have a general idea of how you'd do this. It might take a little effort, though.

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? :huh:
PICNIC - Problem In Chair, Not In Computer

Posted Image Posted Image

20 Things I Learned About Browsers and the Web

#3 Scotty0844

Scotty0844

  • Members
  • 1 posts
  • OFFLINE
  •  
  • Location:Inacom Information Systems
  • Local time:11:26 AM

Posted 19 March 2010 - 08:43 AM

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.

Or you can try CCleaner.

Edited by Scotty0844, 19 March 2010 - 08:51 AM.


#4 gorydragon

gorydragon
  • Topic Starter

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 19 March 2010 - 02:26 PM

Thanks a lot both of you, thats exactly what i wanted.

#5 keyboardNinja

keyboardNinja

    Bleepin' Ninja


  • Members
  • 4,815 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:teh interwebz
  • Local time:09:26 AM

Posted 19 March 2010 - 02:32 PM

You're welcome! :huh:
PICNIC - Problem In Chair, Not In Computer

Posted Image Posted Image

20 Things I Learned About Browsers and the Web

#6 gorydragon

gorydragon
  • Topic Starter

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 19 March 2010 - 02:44 PM

when i used

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 keyboardNinja

keyboardNinja

    Bleepin' Ninja


  • Members
  • 4,815 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:teh interwebz
  • Local time:09:26 AM

Posted 19 March 2010 - 02:47 PM

The /p toggles ON the prompt for confirmation. You don't need that. Just leave it off. :huh:

Edited by keyboardNinja, 19 March 2010 - 02:48 PM.

PICNIC - Problem In Chair, Not In Computer

Posted Image Posted Image

20 Things I Learned About Browsers and the Web

#8 gorydragon

gorydragon
  • Topic Starter

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 20 March 2010 - 01:11 PM

when i use the /p, it doesnt prompt me, but it doesnt delete anything either. without the /p, it prompts me, but it does delete the items if i say yes.

#9 strolln

strolln

  • Members
  • 400 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:N. Calif.
  • Local time:07:26 AM

Posted 26 March 2010 - 03:44 PM

when i use the /p, it doesnt prompt me, but it doesnt delete anything either. without the /p, it prompts me, but it does delete the items if i say yes.

Instead of /p try /q. Be careful though since this will delete blindly so make doubly sure your del command is correct!
To Err is human; to really foul things up requires a Bleeping Computer!

#10 gorydragon

gorydragon
  • Topic Starter

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 15 April 2010 - 01:57 AM

it would just be
del C:\Users\Jesse\Desktop\Daily Delete\*.* /q
correct?

#11 strolln

strolln

  • Members
  • 400 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:N. Calif.
  • Local time:07:26 AM

Posted 15 April 2010 - 08:42 AM

Yes.
To Err is human; to really foul things up requires a Bleeping Computer!

#12 gorydragon

gorydragon
  • Topic Starter

  • Members
  • 55 posts
  • OFFLINE
  •  
  • Local time:10:26 AM

Posted 03 May 2010 - 08:12 PM

that last bit has been working great everyone, thanks a lot.
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 strolln

strolln

  • Members
  • 400 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:N. Calif.
  • Local time:07:26 AM

Posted 03 May 2010 - 10:59 PM

To delete a folder you need to use the rmdir or rd command. Your 2nd line should be: rd C:\Users\Jesse\Desktop\Daily Delete /q
That will delete the Daily Delete folder.

Edited by strolln, 03 May 2010 - 11:04 PM.

To Err is human; to really foul things up requires a Bleeping Computer!

#14 keyboardNinja

keyboardNinja

    Bleepin' Ninja


  • Members
  • 4,815 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:teh interwebz
  • Local time:09:26 AM

Posted 03 May 2010 - 11:18 PM

Isn't that what I said in my first reply...?

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.
PICNIC - Problem In Chair, Not In Computer

Posted Image Posted Image

20 Things I Learned About Browsers and the Web

#15 Romeo29

Romeo29

    Learning To Bleep


  • Members
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:10:26 AM

Posted 04 May 2010 - 12:17 PM

Use this to get rid of the folder :
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users