简体   繁体   English

遍历子目录并创建类似的目录结构来处理子目录中的每个文件

[英]Traversing subdirectories & create similar directory structure to process each file in sub directories

I want to create a batch script to process the directory and files in that directory, Basically I am using one tool to convert files in directory to some format and it can take each file separately also can handle complete directory.我想创建一个批处理脚本来处理该目录中的目录和文件,基本上我使用一个工具将目录中的文件转换为某种格式,它可以单独处理每个文件也可以处理完整目录。 Now I want to convert all the files in directory/sub directory with same directory structure for eg.现在我想转换目录/子目录中具有相同目录结构的所有文件,例如。

║
║═════ Folder 1
║         ║
║         ║══════ Folder A
║                     ║
║                     ║═════ File1.adt
║
║═════ Folder 5
          ║
          ║═════ File5.adt

Now I want the conversion of above files in same directory structure but can be at different location.现在我想在相同的目录结构中转换上述文件,但可以在不同的位置。

║
║═════ Folder 1
║         ║
║         ║══════ Folder A
║                     ║
║                     ║═════ File1.txt
║
║═════ Folder 5
          ║
          ║═════ File5.txt

You might try something like this:你可以尝试这样的事情:

@echo off
for /r "c:\adt_folder_root" %%a in (*.adt) do "C:\Program Files\ABC Amber Advantage Converter\abcadv.exe" "%%a" "%%~dpna.csv" 0

The /r switch will traverse the folder structure starting from the folder specified. /r 开关将从指定的文件夹开始遍历文件夹结构。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM