当前位置:网站首页>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后面不写斜杠\就会问是目录还是文件,写上就会直接拷贝
边栏推荐
- Database management tool: dynamic read-write separation
- Configuration swagger
- LeetCode 362. Design Hit Counter(计数器)
- The god-level Alibaba "high concurrency" tutorial - basic + actual combat + source code + interview + architecture is all-inclusive
- Stroke Practice - 62 Valid Sudokus
- What are some useful performance testing tools recommended? Performance testing report charging standards
- SMIC CIM localization project suspended?Rising software: not shut down, changed to remote development!
- LeetCode50天刷题计划(Day 18—— 搜索旋转排序数组(8.50-12.00)
- Flutter气泡框实现
- Not just running away, but saving the guy who mishandled rm -rf /*
猜你喜欢

Does your child lack self-discipline?Ape Counseling: Pay attention to "blank" in the schedule to give children more control

A case of violent parameter tuning in machine learning

gpu-admission 源码分析

Analysis of the implementation principle of UUID from the perspective of source code

7、Instant-ngp

OPNsense安装配置Zenarmor

个推数据资产管理经验 | 教你打造数据质量心电图,智能检测数据“心跳”异常

嘉为蓝鲸荣获工信部“数字技术融合创新应用解决方案”

StoneDB Document Bug Hunting Season 1

一文读懂NFT数字藏品为何风靡全球?
随机推荐
Excel函数公式大全—LOOKUP函数
The author of open source also has a life problem
彩色图和深度图转点云
再有人问你分布式事务,把这篇扔给他
three.js模糊玻璃效果
Excel函数公式大全—HLOOKUP函数
堪称神级的阿里巴巴“高并发”教程——基础+实战+源码+面试+架构 全包了
Analysis of the implementation principle of UUID from the perspective of source code
LeetCode 146. LRU 缓存
Stroke Practice - 62 Valid Sudokus
CLIP还能做分割任务?哥廷根大学提出一个使用文本和图像prompt,能同时作三个分割任务的模型CLIPSeg,榨干CLIP能力...
LeetCode 109. 有序链表转换二叉搜索树
LeetCode 24. Swap nodes in linked list pairwise
被面试官问到消息队列的丢失、重复与积压问题该如何回答
three.js blur glass effect
Drive IT Modernization with Low Code
你有一份斗破苍穹词库,请查收
Centos7 environment uses Mysql offline installation package to install Mysql5.7
An enhanced dynamic packet buffer management.论文核心部分
Pulling drills - 56 Finding the right interval