Updated specific locations to be searchable, take a look at Las Vegas as an example.

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
How to compress multiple subfolders separately
Post Body

I have the directory "Main" with hundreds of parent folders, each one with subfolders, like this:

C:\Main
C:\Main\Parent1\Subfolder1\file1
C:\Main\Parent1\Subfolder1\file99
...
C:\Main\Parent1\Subfolder100\file1
C:\Main\Parent1\Subfolder100\file99

I would like to create zip files (I have 7zip) for each subfolder, like this:

C:\Main\Parent1\Subfolder1.zip
...
C:\Main\Parent1\Subfolder100.zip

I don't need the subfolders, just the files inside. Could you help?

Update: I found this code that helped. But now I have another problem: I have to move every subfolder.zip from its subfolder to its parent folder:

@echo off

:: Please drag and drop the main folder to this batch file

IF /i exist "%~1" (IF /i not exist "%~1\" exit) else (exit)
pushd "%~1"

for /f "Delims=" %%a in ('dir /b /s /ad') do (
                                              cd /d "%%a"
                                              7z.exe a -sdel "%%~na.zip" *.*
                                             )
popd

Update2: Found another script to move the files from Subfolder to Parent:

@echo off
setlocal enabledelayedexpansion

for /f "tokens=*" %%a in ('dir /A:D /S /B "C:\Main\*"') do (
    for %%y in ("%%a\*.zip") do (
        call :GETPARENTPARENT "%%y" ret

        echo ret=!ret!
        move /Y "%%y" "!ret!"
    )
)

goto:EOF

:GETPARENTPARENT
set fileP=%1
echo received=%fileP%
for %%a in (%fileP%) do (
    set parent=%%~dpa
    cd !parent!\..
    set PPPath=!cd!
    for %%x in ("!PPPath!") do (
        set "%~2=%%~dpnx"
    )
)
GOTO:EOF

Author
Account Strength
90%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
1,014
Link Karma
103
Comment Karma
806
Profile updated: 3 days ago
Posts updated: 1 month ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
2 years ago