r3dux.org

A number-pimping side project from the valleys in *NEW* upside-down flavour.
  • rss
  • Home
  • About
  • Email

How To: Compress Each Folder/Directory to Separate Archives in Linux

r3dux | June 27, 2009

Lets say you’ve got a bunch of folders taking up a large swathe of space which you never really use but want to keep, just not taking up stacks of your NAS… How can you easily compress them all up to individual archives of each folder? Dead easy:

1
2
3
4
5
#!/bin/bash
for folder in */
do
  7z a -mx9 -mmt "${folder%/}.7z" "$folder"
done

Save that to a file, chmod +x it and run in the location you want to compress the folders. Every folder (and all contents within) will be compressed to its own foldername.7z archive.

With 7z, -mx9 is the flag for maximum compression, and -mmt says to use multiple CPUs to speed up compression, so omit that part if you’re on a single core machine.

Comments
No Comments »
Categories
How-To, Linux
Tags
7z, Compress, Compression, Directory, Folder, How-To

Comments rss Comments rss
Trackback Trackback

Translate

Categories

Archives

  • July 2010
  • June 2010
  • May 2010
  • April 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009

Post Calendar

July 2010
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  

Tags

10.04 360 ActionScript ActionScript 3.0 Adobe Ballarat Bash Compiz Controller CS4 CUFDIG302A Effect Film Fire Flash Gaming Hack How-To install Jaunty Josh Joplin Group Linkage Linux Little Big Planet Motion mount Music NAS Particle photography Photoshop Problem PS3 r3dux.org Retro Slides Softmod Sound Systems Ubuntu Video VirtualBox Wii Windows XBox

Linkage

  • 9GAG
  • A Day in the Life of Jim
  • Truxnor.net

Gamercard

Prepare for Awesome

Misc.

Creative Commons License

stopsoftwarepatents.eu petition banner

“A person who is nice to you, but rude to the waiter, is not a nice person.”

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox