I'm stuck with a little .bat, can i get some help pls?
Posted: 05 Jan 2010 23:28
Hello,
I'm trying to do a simple bat to check a folder, then chek if that folder has empty subfolders and then delete them, and then compress each remaining subfolder into separate files inside the passed folder (%1)
Something like this:
I have this at the moment:
@ECHO OFF
for /f "delims=" %%i in ('dir "%~f1" /ad /b /s ^| sort /R') do rd "%%i"2>nul
DIR %1 /s /B /AD>%1.tmp
FOR %%i IN (%1.tmp) DO 7za.exe a %%i *.*
But it's not working, i already have spended 4 hours trying to figure the correct way, can i get some help please?
Thanks a lot
I'm trying to do a simple bat to check a folder, then chek if that folder has empty subfolders and then delete them, and then compress each remaining subfolder into separate files inside the passed folder (%1)
Something like this:
Code: Select all
Before processing: MainFolder -- Subfolder1 -- 3 Files
-- Subfolder2 -- 0 Files
-- Subfolder3 -- 6 Files
...
-- A lot more of folders
After processing: MainFolder -- Subfolder1.7z
-- Subfolder3.7z
...
I have this at the moment:
@ECHO OFF
for /f "delims=" %%i in ('dir "%~f1" /ad /b /s ^| sort /R') do rd "%%i"2>nul
DIR %1 /s /B /AD>%1.tmp
FOR %%i IN (%1.tmp) DO 7za.exe a %%i *.*
But it's not working, i already have spended 4 hours trying to figure the correct way, can i get some help please?
Thanks a lot