Dos Script(BAT) - 仅当目录路径匹配特定模式时才打印目录路径
我对 Dos Script 非常陌生,但是我手头有一项任务,我相信在 Dos Scipt(.BAT) 中执行该任务将是最有效的。
我将在 Window XP Professional 中运行此 BAT 文件
目前我有一个驱动器,比方说 B: 驱动器,其中包含 30 个文件夹和 100,000 多个子文件夹(不是文件)
在驱动器内有超过一万个作业文件夹,每个文件夹都有一个作业编号
我需要打印包含作业编号的所有文件夹的列表
作业编号模式 (假设作业编号是 A1234567,第一个字符始终是字母表,后面是 6 - 7 个数字字符,然后是空格和作业名称,
例如 B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls
不幸的是,这个工作编号可能处于不同级别
例如 B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls
例如 B:/Lv1/B5678214 xxxxx/Lv3/Lv4/xxx.xls
例如 B:/Lv1/Lv2/Lv3/ Lv4/Z0425673 xxxxx/Lv5/Lv6/xxx.doc
假设我们从顶部开始,一旦脚本找到作业编号,它就不会继续从该文件夹向下钻取到另一个级别,
因此结果将是这样的,
例如。 B:/Lv1/Lv2/A1234567 xxxxx
例如 B:/Lv1/B5678214 xxxxx
例如 B:/Lv1/Lv2/Lv3/Lv4/Z0425673 xxxxx
I am very new to Dos Script, however I have a task on hand which I believe will be most efficient to execute in Dos Scipt(.BAT).
I will run this BAT file in Window XP Professional
Currently I have a Drive let's say B: Drive which consists of 30 folders and 100,000+ sub folders(not files)
Within the drive there are more than ten thousand job folder and each with a job number
I need to print out a list of all folders that consist of a job number
The job number pattern
(imagine the job number is A1234567 with the first char always an alphabet and the follow by 6 - 7 numeric character then a space and the job name
e.g B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls
Unfortunately this job number maybe in different level
e.g B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls
e.g B:/Lv1/B5678214 xxxxx/Lv3/Lv4/xxx.xls
e.g B:/Lv1/Lv2/Lv3/Lv4/Z0425673 xxxxx/Lv5/Lv6/xxx.doc
Lets say if we start from the top and once the sciprt find the job number, it wont continue to drill down to another level from that folder.
So the outcome will be like this
e.g B:/Lv1/Lv2/A1234567 xxxxx
e.g B:/Lv1/B5678214 xxxxx
e.g B:/Lv1/Lv2/Lv3/Lv4/Z0425673 xxxxx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是:
例如 B:\Lv1\Lv2\A1234567 xxxxx\Lv4\Lv5\xxx.xls
而不是:
例如 B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls
Do you mean:
e.g B:\Lv1\Lv2\A1234567 xxxxx\Lv4\Lv5\xxx.xls
instead of:
e.g B:/Lv1/Lv2/A1234567 xxxxx/Lv4/Lv5/xxx.xls