Solved

Automation File Delete

Posted on 2011-03-11
6
291 Views
Last Modified: 2012-06-27
I need an automated routine that will fire at midnight and delete every file in a specific folder.

Can someone point me at the right application?

.bat file?
Powershell?
0
Comment
Question by:webdork
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 3

Expert Comment

by:tearman
ID: 35112722
batch files are a good starting point.  The open source program xdel offers quite a bit of extended functionality on delete operations as well.
0
 
LVL 3

Expert Comment

by:tearman
ID: 35112728
Oh and you'll want to use Scheduled Tasks to execute the batch file (even while a user is logged off, make SURE you end up entering a username and password).
0
 
LVL 54

Expert Comment

by:Bill Prew
ID: 35113183
Yes, a BAT file could be a good solution to this.  It could be as simple as:

@echo off
del /Q "c:\temp\*.*"

Open in new window

if you wanted to remove all files in the c:\temp folder.  If you need more elaborate criteria for the deletion like file size or age, then you may want to look at a more advanced script language like VB Script or PowerShell.  Or look at some of the free utilities that exist and support that.  I won't share any unless you come back with needs that require them.

Once you vreate the BAT file you can schedule it with the Windows task scheduler, take a look at this tutorial.

http://www.makeuseof.com/tag/how-to-automate-windows-programs-on-a-schedule/

~bp
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 

Author Comment

by:webdork
ID: 35113212
Thanks billprew-- seems simple enough. What is the Q switch?
0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 35113657
The /Q is for "quiet mode", which tells the DEL command not to prompt for confirmation when deleting multiple files via wildcard.

You can always get a summary of command switches by doing the command followed by a /?, kike:

DEL /?

~bp
0
 

Author Closing Comment

by:webdork
ID: 35117787
Thank you. Simple is good...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Learn about cloud computing and its benefits for small business owners.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question