{ "metadata": { "name": "", "signature": "sha256:4522a1354b824e3cc93def4dfd33ea10770f0c573ef1751c7b8406beb1c65b57" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "import os.path as path\n", "from subprocess import call\n", "import glob\n", "import magic" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 20 }, { "cell_type": "code", "collapsed": false, "input": [ "m= magic.Magic()\n", "def walkf(arg, dirname, files):\n", " for fn in files:\n", " if path.isfile(dirname+\"/\"+fn):\n", " flist.append(dirname+\"/\"+fn)\n", "for i in range(150,-1, -1): \n", " print \"i=\", i\n", " fl = filter(path.isdir, glob.glob(\"*\"))\n", " if len(fl)>1:\n", " print \"too many dirs\"\n", " break \n", " fd = fl[0]\n", " print \"fd=\", fd \n", " call([\"mv\", fd, \"tmp\"]) \n", " flist = []\n", " path.walk(\"tmp\", walkf, None)\n", " print flist\n", " if len(flist)>1:\n", " print \"too many files\"\n", " f= flist[0]\n", " print f\n", " call([\"mv\", f, \"x\"])\n", " call([\"rm\", \"-fr\", \"tmp\"])\n", " fm = m.id_filename(\"x\")\n", " print \"magic\", fm\n", " call([\"7z\", \"x\", \"x\"])\n", " if path.exists(\"x~\"):\n", " if \"tar\" in m.id_filename(\"x~\"):\n", " call([\"tar\", \"xf\", \"x~\"])\n", " call(['rm', \"x~\"])\n", " else:\n", " \"????\"\n", " break \n", "m.close() " ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "i= 150\n", "fd= 137\n", "['tmp/137.zip']\n", "tmp/137.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 149\n", "fd= 136\n", "['tmp/136.tar.gz']\n", "tmp/136.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 148\n", "fd= 135\n", "['tmp/135.tar.bz2']\n", "tmp/135.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 147\n", "fd= 134\n", "['tmp/134.tar.gz']\n", "tmp/134.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i= 146\n", "fd= 133\n", "['tmp/133.zip']\n", "tmp/133.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 145\n", "fd= 132\n", "['tmp/132.tar.bz2']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/132.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 144\n", "fd= 131\n", "['tmp/131.zip']\n", "tmp/131.zip\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " Zip archive data, at least v1.0 to extract\n", "i= 143\n", "fd= 130\n", "['tmp/130.tar.gz']\n", "tmp/130.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i= 142\n", "fd= 129\n", "['tmp/129.tar.bz2']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/129.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 141\n", "fd= 128\n", "['tmp/128.zip']\n", "tmp/128.zip\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " Zip archive data, at least v1.0 to extract\n", "i= 140\n", "fd= 127\n", "['tmp/127.tar.gz']\n", "tmp/127.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i= 139\n", "fd= 126\n", "['tmp/126.tar.bz2']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/126.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 138\n", "fd= 125\n", "['tmp/125.tar.bz2']\n", "tmp/125.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 137\n", "fd= 124\n", "['tmp/124.zip']\n", "tmp/124.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 136\n", "fd= 123\n", "['tmp/123.tar.gz']\n", "tmp/123.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i= 135\n", "fd= 122\n", "['tmp/122.zip']\n", "tmp/122.zip\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " Zip archive data, at least v1.0 to extract\n", "i= 134\n", "fd= 121\n", "['tmp/121.zip']\n", "tmp/121.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 133\n", "fd= 120\n", "['tmp/120.tar.gz']\n", "tmp/120.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:10 2014\n", "i= 132\n", "fd= 119\n", "['tmp/119.tar.bz2']\n", "tmp/119.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 131\n", "fd= 118\n", "['tmp/118.tar.bz2']\n", "tmp/118.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 130\n", "fd= 117\n", "['tmp/117.tar.bz2']\n", "tmp/117.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 129\n", "fd= 116\n", "['tmp/116.zip']\n", "tmp/116.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 128\n", "fd= 115\n", "['tmp/115.zip']\n", "tmp/115.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 127\n", "fd= 114\n", "['tmp/114.tar.bz2']\n", "tmp/114.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 126\n", "fd= 113\n", "['tmp/113.tar.bz2']\n", "tmp/113.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 125\n", "fd= 112\n", "['tmp/112.tar.gz']\n", "tmp/112.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 124\n", "fd= 111\n", "['tmp/111.tar.gz']\n", "tmp/111.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 123\n", "fd= 110\n", "['tmp/110.zip']\n", "tmp/110.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 122\n", "fd= 109\n", "['tmp/109.tar.bz2']\n", "tmp/109.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 121\n", "fd= 108\n", "['tmp/108.tar.bz2']\n", "tmp/108.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 120\n", "fd= 107\n", "['tmp/107.tar.gz']\n", "tmp/107.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 119\n", "fd= 106\n", "['tmp/106.tar.gz']\n", "tmp/106.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 118\n", "fd= 105\n", "['tmp/105.zip']\n", "tmp/105.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 117\n", "fd= 104\n", "['tmp/104.zip']\n", "tmp/104.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 116\n", "fd= 103\n", "['tmp/103.tar.gz']\n", "tmp/103.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 115\n", "fd= 102\n", "['tmp/102.tar.bz2']\n", "tmp/102.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 114\n", "fd= 101\n", "['tmp/101.tar.bz2']\n", "tmp/101.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 113\n", "fd= 100\n", "['tmp/100.tar.gz']\n", "tmp/100.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 112\n", "fd= 99\n", "['tmp/99.zip']\n", "tmp/99.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 111\n", "fd= 98\n", "['tmp/98.tar.bz2']\n", "tmp/98.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 110\n", "fd= 97\n", "['tmp/97.zip']\n", "tmp/97.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 109\n", "fd= 96\n", "['tmp/96.tar.bz2']\n", "tmp/96.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 108\n", "fd= 95\n", "['tmp/95.tar.gz']\n", "tmp/95.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 107\n", "fd= 94\n", "['tmp/94.tar.bz2']\n", "tmp/94.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 106\n", "fd= 93\n", "['tmp/93.zip']\n", "tmp/93.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 105\n", "fd= 92\n", "['tmp/92.tar.gz']\n", "tmp/92.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 104\n", "fd= 91\n", "['tmp/91.zip']\n", "tmp/91.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 103\n", "fd= 90\n", "['tmp/90.zip']\n", "tmp/90.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 102\n", "fd= 89\n", "['tmp/89.tar.gz']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/89.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 101\n", "fd= 88\n", "['tmp/88.tar.gz']\n", "tmp/88.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 100\n", "fd= 87\n", "['tmp/87.zip']\n", "tmp/87.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 99\n", "fd= 86\n", "['tmp/86.tar.gz']\n", "tmp/86.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 98\n", "fd= 85\n", "['tmp/85.tar.bz2']\n", "tmp/85.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 97\n", "fd= 84\n", "['tmp/84.tar.bz2']\n", "tmp/84.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 96\n", "fd= 83\n", "['tmp/83.tar.gz']\n", "tmp/83.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 95\n", "fd= 82\n", "['tmp/82.zip']\n", "tmp/82.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 94\n", "fd= 81\n", "['tmp/81.zip']\n", "tmp/81.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 93\n", "fd= 80\n", "['tmp/80.zip']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/80.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 92\n", "fd= 79\n", "['tmp/79.zip']\n", "tmp/79.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 91\n", "fd= 78\n", "['tmp/78.tar.bz2']\n", "tmp/78.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 90\n", "fd= 77\n", "['tmp/77.zip']\n", "tmp/77.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 89\n", "fd= 76\n", "['tmp/76.tar.bz2']\n", "tmp/76.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 88\n", "fd= 75\n", "['tmp/75.zip']\n", "tmp/75.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 87\n", "fd= 74\n", "['tmp/74.zip']\n", "tmp/74.zip\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " Zip archive data, at least v1.0 to extract\n", "i= 86\n", "fd= 73\n", "['tmp/73.zip']\n", "tmp/73.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 85\n", "fd= 72\n", "['tmp/72.zip']\n", "tmp/72.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 84\n", "fd= 71\n", "['tmp/71.tar.gz']\n", "tmp/71.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 83\n", "fd= 70\n", "['tmp/70.tar.bz2']\n", "tmp/70.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 82\n", "fd= 69\n", "['tmp/69.tar.gz']\n", "tmp/69.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 81\n", "fd= 68\n", "['tmp/68.tar.bz2']\n", "tmp/68.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 80\n", "fd= 67\n", "['tmp/67.zip']\n", "tmp/67.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 79\n", "fd= 66\n", "['tmp/66.zip']\n", "tmp/66.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 78\n", "fd= 65\n", "['tmp/65.tar.bz2']\n", "tmp/65.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 77\n", "fd= 64\n", "['tmp/64.zip']\n", "tmp/64.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 76\n", "fd= 63\n", "['tmp/63.tar.bz2']\n", "tmp/63.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 75\n", "fd= 62\n", "['tmp/62.tar.bz2']\n", "tmp/62.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 74\n", "fd= 61\n", "['tmp/61.tar.gz']\n", "tmp/61.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 73\n", "fd= 60\n", "['tmp/60.zip']\n", "tmp/60.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 72\n", "fd= 59\n", "['tmp/59.zip']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/59.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 71\n", "fd= 58\n", "['tmp/58.tar.bz2']\n", "tmp/58.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 70\n", "fd= 57\n", "['tmp/57.tar.bz2']\n", "tmp/57.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 69\n", "fd= 56\n", "['tmp/56.tar.bz2']\n", "tmp/56.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 68\n", "fd= 55\n", "['tmp/55.zip']\n", "tmp/55.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 67\n", "fd= 54\n", "['tmp/54.zip']\n", "tmp/54.zip\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " Zip archive data, at least v1.0 to extract\n", "i= 66\n", "fd= 53\n", "['tmp/53.tar.bz2']\n", "tmp/53.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 65\n", "fd= 52\n", "['tmp/52.tar.bz2']\n", "tmp/52.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 64\n", "fd= 51\n", "['tmp/51.zip']\n", "tmp/51.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 63\n", "fd= 50\n", "['tmp/50.tar.gz']\n", "tmp/50.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i= 62\n", "fd= 49\n", "['tmp/49.zip']\n", "tmp/49.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 61\n", "fd= 48\n", "['tmp/48.tar.bz2']\n", "tmp/48.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 60\n", "fd= 47\n", "['tmp/47.tar.gz']\n", "tmp/47.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:09 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 59\n", "fd= 46\n", "['tmp/46.zip']\n", "tmp/46.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 58\n", "fd= 45\n", "['tmp/45.tar.bz2']\n", "tmp/45.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 57\n", "fd= 44\n", "['tmp/44.zip']\n", "tmp/44.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 56\n", "fd= 43\n", "['tmp/43.tar.bz2']\n", "tmp/43.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 55\n", "fd= 42\n", "['tmp/42.tar.bz2']\n", "tmp/42.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 54\n", "fd= 41\n", "['tmp/41.tar.gz']\n", "tmp/41.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 53\n", "fd= 40\n", "['tmp/40.zip']\n", "tmp/40.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 52\n", "fd= 39\n", "['tmp/39.zip']\n", "tmp/39.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 51\n", "fd= 38\n", "['tmp/38.tar.bz2']\n", "tmp/38.tar.bz2\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " bzip2 compressed data, block size = 900k\n", "i= 50\n", "fd= 37\n", "['tmp/37.zip']\n", "tmp/37.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 49\n", "fd= 36\n", "['tmp/36.tar.gz']\n", "tmp/36.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 48\n", "fd= 35\n", "['tmp/35.tar.gz']\n", "tmp/35.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 47\n", "fd= 34\n", "['tmp/34.tar.bz2']\n", "tmp/34.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 46\n", "fd= 33\n", "['tmp/33.tar.bz2']\n", "tmp/33.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 45\n", "fd= 32\n", "['tmp/32.tar.gz']\n", "tmp/32.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 44\n", "fd= 31\n", "['tmp/31.tar.bz2']\n", "tmp/31.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 43\n", "fd= 30\n", "['tmp/30.tar.bz2']\n", "tmp/30.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 42\n", "fd= 29\n", "['tmp/29.tar.gz']\n", "tmp/29.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 41\n", "fd= 28\n", "['tmp/28.tar.gz']\n", "tmp/28.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 40\n", "fd= 27\n", "['tmp/27.zip']\n", "tmp/27.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 39\n", "fd= 26\n", "['tmp/26.zip']\n", "tmp/26.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 38\n", "fd= 25\n", "['tmp/25.tar.bz2']\n", "tmp/25.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 37\n", "fd= 24\n", "['tmp/24.zip']\n", "tmp/24.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 36\n", "fd= 23\n", "['tmp/23.tar.gz']\n", "tmp/23.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 35\n", "fd= 22\n", "['tmp/22.tar.gz']\n", "tmp/22.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 34\n", "fd= 21\n", "['tmp/21.zip']\n", "tmp/21.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 33\n", "fd= 20\n", "['tmp/20.tar.gz']\n", "tmp/20.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 32\n", "fd= 19\n", "['tmp/19.tar.bz2']\n", "tmp/19.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 31\n", "fd= 18\n", "['tmp/18.tar.gz']\n", "tmp/18.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 30\n", "fd= 17\n", "['tmp/17.tar.gz']\n", "tmp/17.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 29\n", "fd= 16\n", "['tmp/16.tar.bz2']\n", "tmp/16.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 28\n", "fd= 15\n", "['tmp/15.tar.bz2']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/15.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 27\n", "fd= 14\n", "['tmp/14.tar.gz']\n", "tmp/14.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 26\n", "fd= 13\n", "['tmp/13.zip']\n", "tmp/13.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 25\n", "fd= 12\n", "['tmp/12.tar.bz2']\n", "tmp/12.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 24\n", "fd= 11\n", "['tmp/11.zip']\n", "tmp/11.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 23\n", "fd= 10\n", "['tmp/10.zip']\n", "tmp/10.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 22\n", "fd= 9\n", "['tmp/9.tar.gz']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/9.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 21\n", "fd= 8\n", "['tmp/8.zip']\n", "tmp/8.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 20\n", "fd= 7\n", "['tmp/7.tar.bz2']" ] }, { "output_type": "stream", "stream": "stdout", "text": [ "\n", "tmp/7.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i= 19\n", "fd= 6\n", "['tmp/6.tar.bz2']\n", "tmp/6.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 18\n", "fd= 5\n", "['tmp/5.zip']\n", "tmp/5.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 17\n", "fd= 4\n", "['tmp/4.zip']\n", "tmp/4.zip\n", "magic Zip archive data, at least v1.0 to extract\n", "i= 16\n", "fd= 3\n", "['tmp/3.tar.gz']\n", "tmp/3.tar.gz\n", "magic" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 15\n", "fd= 2\n", "['tmp/2.tar.bz2']\n", "tmp/2.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 14\n", "fd= 1\n", "['tmp/1.tar.gz']\n", "tmp/1.tar.gz\n", "magic gzip compressed data, from Unix, last modified: Fri Aug 15 17:22:08 2014\n", "i= 13\n", "fd= 0\n", "['tmp/0.tar.bz2']\n", "tmp/0.tar.bz2\n", "magic bzip2 compressed data, block size = 900k\n", "i=" ] }, { "output_type": "stream", "stream": "stdout", "text": [ " 12\n", "fd= -1\n", "[]\n" ] }, { "ename": "IndexError", "evalue": "list index out of range", "output_type": "pyerr", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mIndexError\u001b[0m Traceback (most recent call last)", "\u001b[1;32m\u001b[0m in \u001b[0;36m\u001b[1;34m()\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0mlen\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mflist\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m>\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 19\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"too many files\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 20\u001b[1;33m \u001b[0mf\u001b[0m\u001b[1;33m=\u001b[0m \u001b[0mflist\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 21\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 22\u001b[0m \u001b[0mcall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"mv\"\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mf\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m\"x\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", "\u001b[1;31mIndexError\u001b[0m: list index out of range" ] } ], "prompt_number": 63 }, { "cell_type": "code", "collapsed": false, "input": [ "path.walk?" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 58 }, { "cell_type": "code", "collapsed": false, "input": [], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 47 } ], "metadata": {} } ] }