windows - 将多个文件从多个文件夹 move 到一个文件夹

标签 windows batch-file cmd directory move

我正在寻找一个 .bat 文件,它可以查看包含同名子文件夹的多个文件夹,并将其内容 move 到指定文件夹。

文件夹结构:
主文件夹

  1. MainTextures_folder
  2. Prop 文件夹
    --model1_子文件夹
    ------Textures_subfolder
    ----------图像文件
    --model2_子文件夹
    --------Textures_subfolder
    ----------图像文件
    --model3_子文件夹
    --------Textures_subfolder
    ----------图像文件
    --model4_子文件夹
    --------Textures_subfolder
    ----------图像文件

我需要将所有图像文件从其 Textures_subfolder move 到 MainTextures_folder。

感谢您的帮助。

最佳答案

这需要 props 文件夹下的 model* 文件夹,并且每个 model* 文件夹都有一个 textures 文件夹。 MainTextures 文件夹位于 Main_folder 中。

它未经测试,应该将每个纹理文件夹中的所有文件 move 到 MainTextures 文件夹中。

@echo off
pushd "Main_folder\Props"
for /f "delims=" %%a in ('dir model* /b /ad') do (
move /-y "%%a\textures\*.*" "..\MainTextures"
)
popd

关于windows - 将多个文件从多个文件夹 move 到一个文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17148548/

相关文章:

python - 将参数从批处理文件传递到 Python

c - 找不到头文件 "glade.h": Code::Blocks - Windows 7

windows - Microsoft Windows DRM 服务器提示

c# - 将解决方案升级到 Windows 8.1 后出现神秘的构建错误

sql - psql : server closed the connection unexepectedly

windows - 比较批处理脚本中的数字数组

windows - 用于检查字符串是否包含其他字符串的 bat 文件脚本

Windows 上的 Java : Test if a Java application is run as an elevated process (with Administrator privileges)

java - 无法使用批处理文件执行java程序

batch-file - 在 Windows 批处理文件中多次处理文件...循环。为什么?