Jump to content



Photo

How to compress files exist in one folder into seperated .7z files


  • Please log in to reply
15 replies to this topic

#1 MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 07 December 2012 - 09:46

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.


#2 +FiB3R

FiB3R

    aka DARKFiB3R

  • Tech Issues Solved: 6
  • Joined: 06-November 02
  • Location: SE London
  • OS: Windows 8.1 Enterprise
  • Phone: Lumia 930

Posted 07 December 2012 - 15:05

Can't see an option to do that with 7zip. It's there in WinRAR though.

Edit: http://notepad.pathe...-line-examples/

#3 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 07 December 2012 - 21:05

but how to apply these commands lines?

#4 yxz

yxz

    Neowinian Senior

  • Joined: 11-January 09

Posted 07 December 2012 - 23:16

drag-and-drop onto batch file

http://dropcanvas.com/w7u6a/1
@echo off
rem 7z.exe path
set sevenzip=
if [%1]==[] echo file not found&pause&exit
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
cd /d %~dp1||(echo ERROR&pause&exit)
echo %~dp1
echo %~x1
pause
for %%a in (*%~x1) do "%sevenzip%" a "%%~na.7z" "%%a"
pause


#5 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 08 December 2012 - 07:19

Posted Image
Posted Image

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.

#6 yxz

yxz

    Neowinian Senior

  • Joined: 11-January 09

Posted 08 December 2012 - 08:42

http://dropcanvas.com/w7u6a/3
@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=.mp4
for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"
pause


#7 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 08 December 2012 - 08:54

http://dropcanvas.com/w7u6a/3

@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=.mp4
for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"
pause

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.

#8 yxz

yxz

    Neowinian Senior

  • Joined: 11-January 09

Posted 08 December 2012 - 09:05

for %%a in (*%extension%) do "%sevenzip%" a "%%~na.7z" "%%a"
->
for %%a in (*%extension%) do "%sevenzip%" a -mx "%%~na.7z" "%%a"


have fun :)

#9 Mark

Mark

    (: ollǝɥ

  • Joined: 22-October 04
  • Location: Derbyshire, UK

Posted 08 December 2012 - 09:22

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"

#10 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 08 December 2012 - 09:34

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?

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.

#11 yxz

yxz

    Neowinian Senior

  • Joined: 11-January 09

Posted 08 December 2012 - 09:39

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

#12 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 08 December 2012 - 09:41

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

#13 +BudMan

BudMan

    Neowinian Senior

  • Tech Issues Solved: 93
  • Joined: 04-July 02
  • Location: Schaumburg, IL
  • OS: Win7, Vista, 2k3, 2k8, XP, Linux, FreeBSD, OSX, etc. etc.

Posted 08 December 2012 - 13:16

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 ;)

bigger.png

#14 D. S.

D. S.

    Hate is the new Love

  • Tech Issues Solved: 1
  • Joined: 15-June 04
  • Location: Portugal
  • OS: Windows 7 Ultimate x64
  • Phone: Nokia 113

Posted 08 December 2012 - 13:24

You can also use PeaZip. It supports .7z and has an option to compress each file into a separate archive.

#15 OP MGadAllahBH

MGadAllahBH

    Neowinian

  • Joined: 22-November 12
  • Location: Egypt-cairo
  • OS: Windows 7 Ultimate 64 bit
  • Phone: Samsung Galaxy S2 GT-i9100

Posted 08 December 2012 - 14:29

Thanks and i will test it.