<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: archive code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 00:16:34 GMT</pubDate>
    <description>DZone Snippets: archive code</description>
    <item>
      <title>decompressing various archive types</title>
      <link>http://snippets.dzone.com/posts/show/5328</link>
      <description>// decompressing various archive types with this python script&lt;br /&gt;// usage unpack &lt;archive filename&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/usr/bin/env python&lt;br /&gt;#&lt;br /&gt;# simple python script for extracting mostly used types of archives&lt;br /&gt;# this script extracts .tar, .tar.gz, .tar.bz2, .gz and .zip archives &lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;import sys	# required for fetching command line arguments &lt;br /&gt;import os	# required for calling commands for archive extracting&lt;br /&gt;&lt;br /&gt;def unpack(s):									# this is definition of depack&lt;br /&gt;	if (s.find('.tar.gz') != -1):				#	function. It takes string&lt;br /&gt;		os.system("tar -xvvzf " + filename)		#   filename as argument.&lt;br /&gt;	elif (s.find('.tar.bz2') != -1):			#	functon than calls &lt;br /&gt;		os.system("tar -xvvjf " + filename)		#   appropriate command according&lt;br /&gt;	elif (s.find('.tar') != -1):				# 	to file extension&lt;br /&gt;		os.system("tar -xvvf " + filename)&lt;br /&gt;	elif (s.find('.gz') != -1):&lt;br /&gt;		os.system("gunzip" + filename)			&lt;br /&gt;	elif (s.find('.zip') != -1):		&lt;br /&gt;		os.system("unzip " + filename)&lt;br /&gt;	else: print "Wrong archive or filename"		# other types not supported&lt;br /&gt;&lt;br /&gt;try:											# this is main program&lt;br /&gt;	filename = sys.argv[1]						# first argument right after&lt;br /&gt;	unpack(filename)							#	'unpack' command goes in the&lt;br /&gt;except IndexError:								#	filename string&lt;br /&gt;	print "Filename is invalid!"				#	than the depack function is called&lt;br /&gt;&lt;br /&gt;# try-except block is used for handling IndexError exception if no argument is passed&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 06 Apr 2008 22:31:57 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5328</guid>
      <author>Tvrtko (Tvrtko)</author>
    </item>
    <item>
      <title>Searching through your Twitter archive</title>
      <link>http://snippets.dzone.com/posts/show/5158</link>
      <description>This Ruby code downloads previous twitter entries as html files to a local file directory.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;(1..5).each {|i| `wget --user=jrobertson --password=secret http://twitter.com/account/archive?page=#{i}`}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;then using grep -i &lt;keyword&gt; * you can search for anything you've twittered in the past.&lt;br /&gt;&lt;br /&gt;Note: Use Wget sparingly.</description>
      <pubDate>Wed, 20 Feb 2008 12:55:59 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5158</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
  </channel>
</rss>
