Link to home
Start Free TrialLog in
Avatar of webdork
webdork

asked on

Automation File Delete

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?
Avatar of tearman
tearman
Flag of United States of America image

batch files are a good starting point.  The open source program xdel offers quite a bit of extended functionality on delete operations as well.
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).
Avatar of Bill Prew
Bill Prew

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
Avatar of webdork

ASKER

Thanks billprew-- seems simple enough. What is the Q switch?
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of webdork

ASKER

Thank you. Simple is good...