简体   繁体   中英

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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