Batch Scripting: Appending the name of a child directory to its parent -
I am writing a part of a script to add a child directory name to its parent. For example ...
path / in / d / folders / 2.2 / ...
i
Now I have a hard-code solution with a number:
For / d %% a in (C: \ path \ to \ the \ Folders \ *) "%% a" "%% a.3.2"
.3.2 Adding a postfix changes each folder in "folder"
@ECHO OFF SETLOCAL SET "sourcedir = U: \ sourcedir" for / F "token = 1 * delims =" %% an IN ('dir / b / ad'% sourcedir% * * ') DO (ECHO "% sourcedir%. %% a \ %% a \") GOTO: EOF This should work for you - this is just ECHO
- how you use it depends on you.
Your path / in / da / folders looks different from 2.2.2 / 2.2 /////> path / in / the / folders.3.2 (directory separator) in more ways than just /
(switch indicator) in place of code> - \
Comments
Post a Comment