Bat Script-Delete a folder that has been modified for too long the main use of forfiles

Source: Internet
Author: User

::D elete folder::by ZF 20151019echo off&setlocal enabledelayedexpansion:beginset folder_path=d:\deleteset/p folder_date= "Pls input valid date (7| | 2015/10/19): ":: Set folder_date=30::forfiles/p%folder_path%/s/m zte*/d-2015/10/15forfiles/p%folder_path%/d-%fold Er_date%/M lh_*if not%errorlevel%==0 goto exset/p yn= "is you sure delete the folder above (y/n):" If%yn%==y goto ST::I F%yn%== "y" goto stpauseexit:stforfiles/p%folder_path%/d-%folder_date%/M lh_*/C "cmd/c rd/s/q @path: Expauseexit

Interactive manual removal.

::D elete folder::by ZF 20151019echo off&setlocal enabledelayedexpansion:beginset folder_path=d:\deleteset folder_ Date=3::set folder_date=30::forfiles/p%folder_path%/s/m zte*/d-2015/10/15forfiles/p%folder_path%/d-%folder_date %/M lh_*if%errorlevel%==0 goto stexit:stforfiles/p%folder_path%/d-%folder_date%/M lh_*/C "cmd/c rd/s/q @path

Can be added to a scheduled task and processed on a regular basis. window2003 under test pass.


PS: There is known to be able to delete the folder periodically (by file name delete), such as, test20151001_1 can guide me.


There must be Xie in the auspicious.

Bat Script-Delete a folder that has been modified for too long the main use of forfiles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.