Solved

Automation File Delete

Posted on 2011-03-11
6
281 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 53

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
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

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

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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

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…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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