How do I create a batch script that will delete a folder on a scheduled basis?

五迷三道 提交于 2019-12-25 00:19:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!