How to batch compress folders?


Answer: 1

32 hours ago

I want to batch compress folders, I want the format to be 7zip and of course I want to preserve the name and get the .7z extension at the end.

Answer: 2

35 hours ago

Yes as Elder Geek suggested I used a bash script

This is the script I used

for folder in */
  7z a -mx7 -mmt "${folder%/}.7z" "$folder"

You can personalize this part to your preferences, more information on this

7z a -mx7 -mmt

If you do not want to read that article, this is what information will be very useful: you see -mx7 in above line, if yes you can set the last number from 0 to 9. That will tell 7 zip what compression mode to use 0 means store and 9 is ultra mode so if you write -mx0 it will compress very fast but the file size will be big. if you write -mx9 then compression will take more time but the file size will be small.

So what do you do with above text. You create a text document you paste the above text into it and save it. you can name it what ever you want, for example (test)

then open terminal and cd into the directory where your folders are that you want to compress.

type in the terminal: bash then space and drag and drop your created text file into terminal and press enter. you terminal commend might look like something like this

bash '/home/uname/Desktop/test'

it will start compressing and after it is finished you will have your compressed files.

Added by: Destin Strosin

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9