windows - 复制Windows cmd中按条件选择的多个文件
问题描述
我正在尝试将所有具有 2 位数字格式的文件(例如 12.txt、15.pdf、25.doc... 等)从一个目录复制到另一个目录,这是在 Windows 中。
在 Linux 中这有效:
cp -t target_directory {10..99}.*
在 Windows 中,解决方案是什么?
解决方案
This is ugly but should work
for /L %i in (10,1,99) do @copy %i.* dest_folder_here >nul 2>&1
It tries every file in the range suppressing conditions. Adjust copy
to overwrite if needed.
推荐阅读
- javascript - 如何保持按钮突出显示(ReactJS)?
- javascript - 使用 axios.all 发送基本身份验证
- php - require_once 显示警告和致命错误,但在正确的目录中
- serialization - 在 OCaml 的 StdLib 中序列化“模块随机”的当前状态
- typescript - 如何让 CDK 仅创建一个弹性 IP 地址以用于单个 EC2 实例 (AWS CDK)
- javascript - Object.Assign 以数组形式返回值,要求以对象形式返回
- python - 用于用户登录的 Python 数据库连接
- node.js - 带有 ts 的 nodeJS :模块在本地声明组件,但未导出
- r - 如何在 Shiny 的另一个选项卡中呈现表格输出?
- java - Spring框架中的Spring IoC是服务定位器模式吗?