问题
Exact Duplicates:
- How to write a batch file to delete the files which are 5 days or older from a folder?
- write a batch file to delete 6 days older files from a folder
- write a batch file to delete 5 daya older files from a folder
- How do I write a batch file to delete folders and files on a time basis?
- write a batch file to remove the folders by date and time wise.
- write a script to delete files from a folder which are 5 days older than current date
How do I create a batch script that will delete a folder on a scheduled basis?
回答1:
Write a batch script to delete the file
rd <YOURDIR>
and then schedule it in Windows Tasks.
回答2:
Create a batch to delete the file and then place it on a scheduled task on a server or workstation.
回答3:
You write your batch file and then, even better than using the Scheduler manually, you can use the at command to schedule the .bat file to run periodically.
The advantage of this is that you can put your final at command in a second bat file for easier distribution to your target systems.
at reference page on help.microsoft.com
回答4:
In a text editor do the following
@echo off
rd <enter your directory name here>
Save the file as filename.bat
Create a scheduled task and select the batch file as the file to run.
来源:https://stackoverflow.com/questions/615008/how-do-i-create-a-batch-script-that-will-delete-a-folder-on-a-scheduled-basis