i have a root folder, containing sub-folder like:
I am trying to recursively archive "SourceCode" folder. which is labelled in in 4 variations , hence the (*code*) in below batch file
The problem im facing is, the parent folder are not very organised and contains <spaces>, <_>, <-> etc
\Folder-01\Random Directory Name 01
as mention in above example.
Im trying to batch it, with the code below
which is working fine in directories which doesnt contain any spaces, etc. and producing respective .zip files alongside *sourcecode* folder.
can someone help me how to tackle this delims issues?
is not helping
I have over 26,000 such sub-directory to archive hence looking to automate it.
-----------------
good to have, but not mandatory.
instead the the zip files named as sourcecode.zip, possible to adapt one stop above directory such as "Random Directory Name 01.zip" and post archival delete the original "sourcecode folder" keeping only these files
TIA.
please note, archive format is not necessary to be zip but its preferred as it can be opened in any OS without additional software. i can also use winrar instead of 7zip.
Code:\---Folder-01 +---Random Directory Name 01 | | 9_1 - Klnp pf.xyz | | 9_17 - Joy R5j.xyz | | 9_30 - pre eye.xyz | | | \---SourceCode | | ppppy.txt | | | +---Changelog | | folder9.code | | | \---version | 41k.code | 3D.code \---Folder-02 +---Random Directory Name 02 | | 9_1_Klnp pf.xyz | | 9_17 - Joy R5j.xyz | | 9_30 - pre eye.xyz | | | \---Source - Code | | ppppy.txt | | | +---Changelog | | folder9.code | | | \---version, number | | 41k.code |
I am trying to recursively archive "SourceCode" folder. which is labelled in in 4 variations , hence the (*code*) in below batch file
- Source Code
- Source-Code
- Source_Code
- SourceCode
The problem im facing is, the parent folder are not very organised and contains <spaces>, <_>, <-> etc
\Folder-01\Random Directory Name 01
as mention in above example.
Im trying to batch it, with the code below
Code:
for /d /r %%a IN (*code*) do (
7z.exe a -r -tzip %%a.zip %%a\*
)
which is working fine in directories which doesnt contain any spaces, etc. and producing respective .zip files alongside *sourcecode* folder.
can someone help me how to tackle this delims issues?
Code:
/f delims=*
is not helping

I have over 26,000 such sub-directory to archive hence looking to automate it.
-----------------
good to have, but not mandatory.
instead the the zip files named as sourcecode.zip, possible to adapt one stop above directory such as "Random Directory Name 01.zip" and post archival delete the original "sourcecode folder" keeping only these files
Code:
\---Folder-01
+---Random Directory Name 01
| | 9_1 - Klnp pf.xyz
| | 9_17 - Joy R5j.xyz
| | 9_30 - pre eye.xyz
| | SourceCode.zip
TIA.
please note, archive format is not necessary to be zip but its preferred as it can be opened in any OS without additional software. i can also use winrar instead of 7zip.
Last edited: