MGadAllahBH Posted December 7, 2012 Share Posted December 7, 2012 Hello, If I've a folder includes 10 .mp4 files. I'd like to compress these 10 files using 7z, so I right click each file and do the process to add to archive. The result is 10 compressed .7z files. I do not want to compress all files into one big archive. My question is how to comprress each file of these 10 .avi seperately once into .7z, or in other word in one step instead of re-do the process for 10 times? If there is any other tool to do the job it will be good as well. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/ Share on other sites More sharing options...
FiB3R Posted December 7, 2012 Share Posted December 7, 2012 Can't see an option to do that with 7zip. It's there in WinRAR though. Edit: http://notepad.pathe...-line-examples/ Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595374910 Share on other sites More sharing options...
MGadAllahBH Posted December 7, 2012 Author Share Posted December 7, 2012 but how to apply these commands lines? Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595375880 Share on other sites More sharing options...
yxz Posted December 7, 2012 Share Posted December 7, 2012 drag-and-drop onto batch file http://dropcanvas.com/w7u6a/1 @echo offrem 7z.exe pathset sevenzip=if [%1]==[] echo file not found&pause&exitif "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exeif "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exeif "%sevenzip%"=="" echo 7-zip not found&pause&exitcd /d %~dp1||(echo ERROR&pause&exit)echo %~dp1echo %~x1pausefor %%a in (*%~x1) do "%sevenzip%" a "%%~na.7z" "%%a"pause[/CODE] Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376184 Share on other sites More sharing options...
MGadAllahBH Posted December 8, 2012 Author Share Posted December 8, 2012 This is the folder I want to compress files included into seperated files. When I run the batch file I get this error that file not found, and when I press any key to continue I found it close itself. Please help. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376904 Share on other sites More sharing options...
yxz Posted December 8, 2012 Share Posted December 8, 2012 http://dropcanvas.com/w7u6a/3 @echo offcd /d %~dp0rem 7z.exe pathset sevenzip=if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exeif "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exeif "%sevenzip%"=="" echo 7-zip not found&pause&exitset extension=.mp4for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"pause[/CODE] MGadAllahBH 1 Share Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376960 Share on other sites More sharing options...
MGadAllahBH Posted December 8, 2012 Author Share Posted December 8, 2012 On 08/12/2012 at 08:42, yxz said: http://dropcanvas.com/w7u6a/3 @echo offcd /d %~dp0rem 7z.exe pathset sevenzip=if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exeif "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exeif "%sevenzip%"=="" echo 7-zip not found&pause&exitset extension=.mp4for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"pause[/CODE] Amazing you are the man and thanks a lot.Please one last thing, please in this little script may you tell me what is the setting for the 7z to get the most maximum compression? Thanks a lot. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376968 Share on other sites More sharing options...
yxz Posted December 8, 2012 Share Posted December 8, 2012 for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a" -> for %%a in (*%extension%) do "%sevenzip%" a -mx "%%~na.7z" "%%a" have fun :) Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376974 Share on other sites More sharing options...
Guest Posted December 8, 2012 Share Posted December 8, 2012 In the future, just: Select the files or folders Right click (assuming you enabled 7z shell integration) Go to7-zip Click add to archive Change archive format to 7z Choose a file size in the section "split to volume, bytes" Press OK Seeing as you want 10 files, just divide the total uncompressed file size in a Google search like this: 49.75 megabytes in bytes (Or whatever the size your file selection is) Then just divide the number by 10 or whatever amount of files you want and enter this into "Split to volumes, bytes" Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376978 Share on other sites More sharing options...
MGadAllahBH Posted December 8, 2012 Author Share Posted December 8, 2012 On 08/12/2012 at 09:05, yxz said: for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a" -> for %%a in (*%extension%) do "%sevenzip%" a -mx "%%~na.7z" "%%a" have fun :) what does -mx means? On 08/12/2012 at 09:22, Mark said: In the future, just: Select the files or folders Right click (assuming you enabled 7z shell integration) Go to7-zip Click add to archive Change archive format to 7z Choose a file size in the section "split to volume, bytes" Press OK Seeing as you want 10 files, just divide the total uncompressed file size in a Google search like this: 49.75 megabytes in bytes (Or whatever the size your file selection is) Then just divide the number by 10 or whatever amount of files you want and enter this into "Split to volumes, bytes" But I do not want to split anything at all and want to make it each file compressed seperated. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376986 Share on other sites More sharing options...
yxz Posted December 8, 2012 Share Posted December 8, 2012 http://sevenzip.sour...d.htm#SevenZipX -mx=5 normal compression -mx=7 maximum compression -mx=9 ultra compression -mx is identical to -mx=9 edit: i ran some tests Path = mx5.7z Method = LZMA2:24 BCJ Physical Size = 6591553 Path = mx7.7z Method = LZMA2:24m BCJ Physical Size = 6567395 Path = mx9.7z Method = LZMA2:24m LZMA:20 BCJ2 Physical Size = 6443632 Path = mx.7z Method = LZMA2:24m LZMA:20 BCJ2 Physical Size = 6443632 MGadAllahBH 1 Share Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376990 Share on other sites More sharing options...
MGadAllahBH Posted December 8, 2012 Author Share Posted December 8, 2012 On 08/12/2012 at 09:39, yxz said: http://sevenzip.sour...d.htm#SevenZipX -mx=5 normal compression -mx=7 maximum compression -mx=9 ultra compression -mx is identical to -mx=9 thanks Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595376992 Share on other sites More sharing options...
+BudMan MVC Posted December 8, 2012 MVC Share Posted December 8, 2012 Not sure I understand the point of this exercise.. Mp4 files rarely compress much at all, no matter what setting you tell your compression software to use. I just did a test setting to ultra, and the 7z is actually bigger ;) Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595377148 Share on other sites More sharing options...
D. S. Veteran Posted December 8, 2012 Veteran Share Posted December 8, 2012 You can also use PeaZip. It supports .7z and has an option to compress each file into a separate archive. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595377162 Share on other sites More sharing options...
MGadAllahBH Posted December 8, 2012 Author Share Posted December 8, 2012 Thanks and i will test it. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595377244 Share on other sites More sharing options...
+BudMan MVC Posted December 8, 2012 MVC Share Posted December 8, 2012 So how much compression are you getting - this exercise seems completely pointless to me if what your saving is a few kb. Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-595377332 Share on other sites More sharing options...
denahv Posted December 25, 2018 Share Posted December 25, 2018 Hello, I know this thread is very old, but I must leave a reply because I find this is perfect solution for archiving multiple files to separate .7z archives! I'm using Windows 10 Pro x64 and 7Zip tool. First you need to download latest version of 7Zip: Download 7-Zip I'm using script in this way and works perfectly: 1. Create blank .txt file 2. Enter this code in blank .txt file: @echo off cd /d %~dp0 rem 7z.exe path set sevenzip= if "%sevenzip%"=="" if exist "%ProgramFiles(x86)%\7-zip\7z.exe" set sevenzip=%ProgramFiles(x86)%\7-zip\7z.exe if "%sevenzip%"=="" if exist "%ProgramFiles%\7-zip\7z.exe" set sevenzip=%ProgramFiles%\7-zip\7z.exe if "%sevenzip%"=="" echo 7-zip not found&pause&exit set extension=.pdf for %%a in (*%extension%) do "%sevenzip%" a -mx "%%~na.7z" "%%a" pause 3. In code change line set extension=. to extension of files that you want to add in archive 4. Save file as, for example separate-archive.bat (you must change extension from .txt to .bat) !! 5. Copy newly created separate-archive.bat file to folder where you want to archive multiple files in separate .7z archives 6. Double click on copied separate-archive.bat 7. Done! Dobule click on file opens a command line and files will be archived in separate .7z archives with Ultra compression 8. Delete separate-archive.bat file from folder where you done archiving If you want different compression level you must change -mx command to desired compression level: On 08/12/2012 at 09:39, yxz said: http://sevenzip.sour...d.htm#SevenZipX -mx=5 normal compression -mx=7 maximum compression -mx=9 ultra compression -mx is identical to -mx=9 Expand for %%a in (*%extension%) do "%sevenzip%" a -mx "%%~na.7z" "%%a" I'm using 7-Zip tool for years, but this is my first use in batch mode in command line. I'm open for suggestions if you have some Thank you very much! Happy archiving! -denahv Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-598401166 Share on other sites More sharing options...
DirectionSky Posted February 1, 2019 Share Posted February 1, 2019 Can any one please help with a batch that puts all the files in to single zip without a sub folder inside that zip Thanks Link to comment https://www.neowin.net/forum/topic/1124240-how-to-compress-files-exist-in-one-folder-into-seperated-7z-files/#findComment-598414051 Share on other sites More sharing options...
Recommended Posts