<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: rar code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 25 Jul 2008 02:19:45 GMT</pubDate>
    <description>DZone Snippets: rar code</description>
    <item>
      <title>Decompress several filetypes with a single script</title>
      <link>http://snippets.dzone.com/posts/show/5785</link>
      <description>// Decompresses Z, gz, bz2, zip, rar, tar, and 7z with a single 'decompress' command&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;# decompress - will decompress a file, regardless of compression type.&lt;br /&gt;&lt;br /&gt;Z="compress -d"&lt;br /&gt;gz="gunzip"&lt;br /&gt;bz="bunzip2"&lt;br /&gt;zip="unzip -qo"&lt;br /&gt;rar="unrar x -id -y"&lt;br /&gt;tar="tar xf"&lt;br /&gt;7z="p7zip -d"&lt;br /&gt;&lt;br /&gt;if [ $# -eq 0 ]; then&lt;br /&gt;    echo "Usage: decompress file or files to decompress"&gt;&amp;2&lt;br /&gt;    exit 1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;for name&lt;br /&gt;do&lt;br /&gt;	if [ ! -f "$name" ] ; then&lt;br /&gt;		echo "$0: file $name not found. Skipped." &gt;&amp;2&lt;br /&gt;		continue&lt;br /&gt;	fi&lt;br /&gt;&lt;br /&gt;	if [ "$(echo $name | egrep '(\.Z$|\.gz$|\.bz2$|\.zip$|\.rar$|\.tar$|\.tgz$|\.7z$)')" = "" ] ; then&lt;br /&gt;		echo "Skipped file ${name}: it's already decompressed." &lt;br /&gt;      		continue&lt;br /&gt;	fi&lt;br /&gt;&lt;br /&gt;	extension=${name##*.}&lt;br /&gt;&lt;br /&gt;	case "$extension" in&lt;br /&gt;		Z ) echo "Filetype is Z. Decompressing..."&lt;br /&gt;		    $Z "$name"&lt;br /&gt;		    ;;&lt;br /&gt;		gz ) echo "Filetype is gz. Decompressing..."&lt;br /&gt;		     $gz "$name"&lt;br /&gt;		     ;;&lt;br /&gt;		bz2 ) echo "Filetype is bz2. Decompressing..."&lt;br /&gt; 		     $bz "$name"&lt;br /&gt;		     ;;&lt;br /&gt;		zip ) echo "Filetype is zip. Decompressing..."&lt;br /&gt;		      $zip "$name"&lt;br /&gt;		      ;;&lt;br /&gt;		rar ) echo "Filetype is rar. Decompressing..."&lt;br /&gt;		      $rar "$name"&lt;br /&gt;		      ;;&lt;br /&gt;		tar ) echo "Filetype is tar. Decompressing..."&lt;br /&gt;              	      $tar "$name"&lt;br /&gt;              	      ;;&lt;br /&gt;		tgz ) echo "Filetype is tgz. Decompressing..."&lt;br /&gt;              	      $tar "$name"&lt;br /&gt;                     ;;&lt;br /&gt;               7z ) echo "Filetype is 7z. Decompressing..."&lt;br /&gt;                     $7z "$name"&lt;br /&gt;	esac&lt;br /&gt;&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;exit 0&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Fri, 18 Jul 2008 02:07:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5785</guid>
      <author>zdenton (Zach Denton)</author>
    </item>
    <item>
      <title>compress files with rar</title>
      <link>http://snippets.dzone.com/posts/show/2696</link>
      <description>rar files with max compressiong and split them into 450k. &lt;br /&gt;&lt;code&gt;&lt;br /&gt;rar a -s -v450 -m5 test.rar test/* &lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 23 Sep 2006 18:26:47 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2696</guid>
      <author>nevadalife (nevada)</author>
    </item>
    <item>
      <title>Create a single JPG gallery from an image archive</title>
      <link>http://snippets.dzone.com/posts/show/878</link>
      <description>The following comes from &lt;a href="http://ascii.textfiles.com/archives/000137.html"&gt;Jason Scott&lt;/a&gt; and is posted here with permission under the &lt;a href="http://creativecommons.org/licenses/by-sa/1.0/"&gt;Creative Commons Attribution-ShareAlike License&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The script expands a zip or rar archive of images, makes thumbnails, and compiles the thumbnails into a single JPG to represent what's in the archive. Requires &lt;a href="http://www.imagemagick.org/"&gt;ImageMagick&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Code:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;# GALLERATE: Turn a zip of images into a gallery.&lt;br /&gt;# From Jason Scott. http://ascii.textfiles.com/archives/000137.html&lt;br /&gt;if [ -f "$1" ]&lt;br /&gt;   then&lt;br /&gt;   rm -rf .galleryworld&lt;br /&gt;   echo "[%] Preparting to squat out $1...."&lt;br /&gt;   mkdir .galleryworld&lt;br /&gt;   cd .galleryworld&lt;br /&gt;   unzip -j "../$1"&lt;br /&gt;   unrar e -ep "../$1"&lt;br /&gt;   echo "[%] WHY DOES IT HURT!!!!"&lt;br /&gt;   montage +frame +shadow +label -tile 7 *.JPG *.GIF *.gif *.jpg *.bmp *.png *.PNG *.BMP "../$1.jpg"&lt;br /&gt;   cd ..&lt;br /&gt;   rm -rf .galleryworld&lt;br /&gt;   ls -l "$1.jpg"&lt;br /&gt;  else&lt;br /&gt;  echo "No such file, assmaster."&lt;br /&gt;fi&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Usage:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;GALLERATE [file]&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;where [file] is the zip or rar archive of images to be processed.</description>
      <pubDate>Wed, 09 Nov 2005 07:05:13 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/878</guid>
      <author>madphilosopher (Darren Paul Griffith)</author>
    </item>
  </channel>
</rss>
