Delete files in subfolder using batch script

后端 未结 5 1683
小鲜肉
小鲜肉 2020-12-30 14:06

I have to delete files from a sub folder with a same name. My file path is like as follows.

d:\\test\\test1\\archive\\*.txt
d:\\test\\try\\archive\\*.txt
d:\         


        
5条回答
  •  被撕碎了的回忆
    2020-12-30 14:35

    Use powershell inside your bat file

    PowerShell Remove-Item c:\scripts\* -include *.txt -exclude *test* -force -recurse
    

    You can also exclude from removing some specific folder or file:

    PowerShell Remove-Item C:/*  -Exclude WINDOWS,autoexec.bat -force -recurse
    

提交回复
热议问题