Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Automation File Delete

Posted on 2011-03-11
6
Medium Priority
?
299 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 57

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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

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

Accepted Solution

by:
Bill Prew earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

722 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