windows - Batch program to automatically sort zip files into folders and extract -
i teacher aid, , job sort student's labs folders. format turn in files this
lastname_labname.zip
what wish accomplish automatically have these zips moved folders in different location. follows format
- lastname1
- lastname2
- lastname3
finally zip files deleted after.
here have far:
to extract files:
for /d /r %%f in ("*") ( pushd %cd% cd %%f %%x in (*.rar *.zip) ( "c:\program files\7-zip\7z.exe" x "%%x" pause ) popd ) to sort files:
@echo off setlocal set "sourcedir=c:\something\something" set "destdir=c:somethign\something" /f "delims=" %%a in ( 'dir /b /a-d "%sourcedir%\*.zip" ' ) ( /f "tokens=1delims=_-" %%b in ("%%a") ( /f "delims=" %%d in ( 'dir /b /ad "%destdir%\*%%b*" ' ) ( move "%%a" "%destdir%\%%d\" ) ) ) goto :eof i combine these functions, , delete zips after.
i have similar setup.
@echo off set down=e:\download set extracted=e:\extracted /r "%down%" %%i in ("*.zip") ( "%programfiles%\7-zip\7z.exe" x -y "%%~fi" -ppasswordgoeshere del "%%i" ) %%i in ("%down%\*") move /y "%%i" "%sotred%\%%~nxi" /xf unzip.bat /d %%i in ("%down%\*") robocopy /move /e "%%i" "%sorted%\%%~nxi" /xf unzip.bat
Comments
Post a Comment