cmd for 遍历目录_DOS 遍历目录及子目录,删除特定名称文件夹或文件

本文介绍了如何在DOS环境下使用cmd命令遍历目录及其子目录,特别是删除名为CVS的文件夹。通过`for /R`命令结合`rd`指令,可以实现递归删除指定目录下的目标文件夹。同时,还提供了其他示例,展示如何遍历目录,打印文件或子目录的绝对路径,并执行更复杂的操作,如用记事本打开文件或启动Firefox。
摘要由CSDN通过智能技术生成

1、遍历某个文件夹及其子文件夹目录,删除全部名为CVS的目录:

进入CMD界面执行以下两句,第一句进入特定待查找的目录,第二句删除当前目录及子目录下全部名为CVS的文件夹

cd "E:\3_DSP"

for /R  %s in (.,*) do  rd /q /s %s\CVS

DOS命令:用For命令遍历文件夹 (2011-04-02 21:29:38)

标签: 技术探究

Syntax:

FOR /R [[drive:]path] %variable IN (set) DO command [command-parameters]

Description:

Walks the directory tree rooted at [drive:]path, executing the FOR statement in each directory of the tree. If no directory specification is specified after /R then the current directory is assumed.

If set is just a single period (.) character then it will just enumerate the directory tree.

If set is just a single asterisk (*) character then it will just enumerate the files.

If set is a single period (.) character followed by a single asterisk (*) character then it will enumerate the sub-folders firstly and then files under t

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值