首页 技术 正文
技术 2022年11月20日
0 收藏 880 点赞 2,630 浏览 941 个字

bat批处理,在工作中会带来很多便利。

例如:想删除多个文件夹内的文件夹“Quality”及其子文件

bat——批量删除文件文件夹

同时删除所有Cyc*文件夹内的所有R00*.tif文件

bat——批量删除文件文件夹

bat——批量删除文件文件夹

则可如下操作

先建立父bat文件run_del_multiple.bat,例,如下代码:

::call 子bat文件 %1 %2 %3 (在子bat中作为路径变量)
call del_tiff.bat Imagefile Lane03 E:\DirectGenomics\SQE\20190307\201903071716_B028_#5228_190123003UYX_3_4_5
call del_tiff.bat Imagefile Lane04 E:\DirectGenomics\SQE\20190307\201903071716_B028_#5228_190123003UYX_3_4_5
call del_tiff.bat Imagefile Lane05 E:\DirectGenomics\SQE\20190307\201903071716_B028_#5228_190123003UYX_3_4_5

建立子bat文件del_tiff.bat,例,如下代码:

@echo off
if exist %3\Quality rmdir /s/q %3\Quality
if not exist %3\Quality ping -n 1 127.0.0.1
for /f %%i in (‘dir /b %3\%1\%2’) do (
if exist %3\%1\%2\%%i\R001*.tif (
del %3\%1\%2\%%i\R001*.tif
) else (
ping -n 1 127.0.0.1
)
if exist %3\%1\%2\%%i\R003*.tif (
del %3\%1\%2\%%i\R003*.tif
) else (
ping -n 1 127.0.0.1
)
if exist %3\%1\%2\%%i\R004*.tif (
del %3\%1\%2\%%i\R004*.tif
) else (
ping -n 1 127.0.0.1
)
)
:END

将两个bat文件保存于同一目录下,双击run_del_multiple.bat即可执行,或者目录下空白处单击右键打开cmd命令窗口将run_del_multiple.bat拖入命令窗,单击回车键也可执行

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,965
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,486
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,331
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,114
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,747
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,781