当前位置:网站首页>bat脚本——提取多个文件夹到指定路径
bat脚本——提取多个文件夹到指定路径
2022-08-10 11:37:00 【天桥飞熊】
问题: 我需要从一个文件夹下面快速查找部分子文件夹,并将其复制到另一个地方
1. 提取原始文件夹下的所有目录名
在原始文件夹下打开cmd,输入以下命令,可以将所有目录名输出到列表.txt
dir/b>E:\列表.txt
dir . > a.txt 把当前目录文件列表写入a.txt。
dir . /s > a.txt 把当前目录文件列表写入a.txt,包括子目录下文件。
2. 复制文件
@echo off
for /f "delims=" %%a in (列表.txt) do (
md D:\temp\复制后
xcopy /y D:\temp\原始文件夹\%%a D:\temp\复制后\%%a\ /s/e )
md 是创建目标文件夹(当文件夹已存在时会提示)
xcopy
- /y 是指当目标文件夹中有同名文件时,不再询问是否覆盖而是直接覆盖。
- /s: 复制非空的目录和子目录。如果省略“/s”,则“xcopy”将在单个目录中工作。
- /e: 复制所有子目录,包括空目录。将“/e”与“/s”和“/t”命令行选项一起使用。
- /t: 只复制子目录结构(即目录树),不复制文件。要复制空目录,必须包含“/e”命令行选项。
- 如果命令结尾%%a后面不写斜杠\就会问是目录还是文件,写上就会直接拷贝
边栏推荐
- Licking Exercise - 63 Find all anagrams in a string
- 制品库是什么?
- 用低代码驱动IT现代化
- LeetCode 237. Delete a node in a linked list
- Ssm framework construction process [easy to understand]
- 如何让别人看不懂你的 JS 代码?把你当大佬!
- Database management tool: dynamic read-write separation
- Excel函数公式大全—HLOOKUP函数
- LeetCode50天刷题计划(Day 17—— 下一个序列(14.50-16.30)
- LeetCode 362. Design Hit Counter(计数器)
猜你喜欢
three.js模糊玻璃效果
嘉为蓝鲸荣获工信部“数字技术融合创新应用解决方案”
时间序列的数据分析(五):简单预测法
一文读懂NFT数字藏品为何风靡全球?
2016,还是到了最后
Does your child lack self-discipline?Ape Counseling: Pay attention to "blank" in the schedule to give children more control
mpf6_Time Series Data_quandl_更正kernel PCA_AIC_BIC_trend_log_return_seasonal_decompose_sARIMAx_ADFull
WeChat applet, global variables change in one place and the state in other places also changes.
技术人必看!数据治理是什么?它对数据中台建设重要吗?
IDC第一的背后,阿里云在打造怎样的一朵“视频云”?
随机推荐
The god-level Alibaba "high concurrency" tutorial - basic + actual combat + source code + interview + architecture is all-inclusive
Servlet---解决post请求中中文乱码问题
Dining (网络流)
An enhanced dynamic packet buffer management.论文核心部分
ViT结构详解(附pytorch代码)
So delicious!Since using this interface artifact, my team efficiency has increased by 60%!
LeetCode 25. A set of K flipped linked lists
可视化服务编排在金融APP中的实践
制品库是什么?
Samsung plans to start producing semiconductor components in Vietnam in 2023
LeetCode 86. 分隔链表
LeetCode 25. K 个一组翻转链表
Analysis of the name matching process between the LCD driver and the device (Tiny4412)
中芯CIM国产化项目暂停?上扬软件:未停摆,改为远程开发!
VSCode remote connection server error: Could not establish connection to "xxxxxx" possible error reasons and solutions
Redis常用命令
LeetCode 92. Reverse Linked List II
正则表达式常用示例
Configuration swagger
石墨文档打开文档时快速定位到上次写的位置