Solved

Automation File Delete

Posted on 2011-03-11
6
265 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
  • 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 52

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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 

Author Comment

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

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

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…
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

947 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now