Advertisement
Guest User

mimetype

a guest
Oct 16th, 2014
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 10.16 KB | None | 0 0
  1. #!/bin/sh
  2. extension=${1##*.}
  3. case $extension in
  4.     "323") type="text/h323"
  5.            ;;
  6.     "acx") type="application/internet-property-stream"
  7.            ;;
  8.     "ai") type="application/postscript"
  9.           ;;
  10.     "aif") type="audio/x-aiff"
  11.            ;;
  12.     "aifc") type="audio/x-aiff"
  13.             ;;
  14.     "aiff") type="audio/x-aiff"
  15.             ;;
  16.     "asf") type="video/x-ms-asf"
  17.            ;;
  18.     "asr") type="video/x-ms-asf"
  19.            ;;
  20.     "asx") type="video/x-ms-asf"
  21.            ;;
  22.     "au") type="audio/basic"
  23.           ;;
  24.     "avi") type="video/x-msvideo"
  25.            ;;
  26.     "axs") type="application/olescript"
  27.            ;;
  28.     "bas") type="text/plain"
  29.            ;;
  30.     "bcpio") type="application/x-bcpio"
  31.              ;;
  32.     "bin") type="application/octet-stream"
  33.            ;;
  34.     "bmp") type="image/bmp"
  35.            ;;
  36.     "c") type="text/plain"
  37.          ;;
  38.     "cat") type="application/vnd.ms-pkiseccat"
  39.            ;;
  40.     "cdf") type="application/x-cdf"
  41.            ;;
  42.     "cdf") type="application/x-netcdf"
  43.            ;;
  44.     "cer") type="application/x-x509-ca-cert"
  45.            ;;
  46.     "class") type="application/octet-stream"
  47.              ;;
  48.     "clp") type="application/x-msclip"
  49.            ;;
  50.     "cmx") type="image/x-cmx"
  51.            ;;
  52.     "cod") type="image/cis-cod"
  53.            ;;
  54.     "cpio") type="application/x-cpio"
  55.             ;;
  56.     "crd") type="application/x-mscardfile"
  57.            ;;
  58.     "crl") type="application/pkix-crl"
  59.            ;;
  60.     "crt") type="application/x-x509-ca-cert"
  61.            ;;
  62.     "csh") type="application/x-csh"
  63.            ;;
  64.     "css") type="text/css"
  65.            ;;
  66.     "dcr") type="application/x-director"
  67.            ;;
  68.     "der") type="application/x-x509-ca-cert"
  69.            ;;
  70.     "dir") type="application/x-director"
  71.            ;;
  72.     "dll") type="application/x-msdownload"
  73.            ;;
  74.     "dms") type="application/octet-stream"
  75.            ;;
  76.     "doc") type="application/msword"
  77.            ;;
  78.     "dot") type="application/msword"
  79.            ;;
  80.     "dvi") type="application/x-dvi"
  81.            ;;
  82.     "dxr") type="application/x-director"
  83.            ;;
  84.     "eps") type="application/postscript"
  85.            ;;
  86.     "etx") type="text/x-setext"
  87.            ;;
  88.     "evy") type="application/envoy"
  89.            ;;
  90.     "exe") type="application/octet-stream"
  91.            ;;
  92.     "fif") type="application/fractals"
  93.            ;;
  94.     "flr") type="x-world/x-vrml"
  95.            ;;
  96.     "gif") type="image/gif"
  97.            ;;
  98.     "gtar") type="application/x-gtar"
  99.             ;;
  100.     "gz") type="application/x-gzip"
  101.           ;;
  102.     "h") type="text/plain"
  103.          ;;
  104.     "hdf") type="application/x-hdf"
  105.            ;;
  106.     "hlp") type="application/winhlp"
  107.            ;;
  108.     "hqx") type="application/mac-binhex40"
  109.            ;;
  110.     "hta") type="application/hta"
  111.            ;;
  112.     "htc") type="text/x-component"
  113.            ;;
  114.     "htm") type="text/html"
  115.            ;;
  116.     "html") type="text/html"
  117.             ;;
  118.     "htt") type="text/webviewhtml"
  119.            ;;
  120.     "ico") type="image/x-icon"
  121.            ;;
  122.     "ief") type="image/ief"
  123.            ;;
  124.     "iii") type="application/x-iphone"
  125.            ;;
  126.     "ins") type="application/x-internet-signup"
  127.            ;;
  128.     "isp") type="application/x-internet-signup"
  129.            ;;
  130.     "jfif") type="image/pipeg"
  131.             ;;
  132.     "jpe") type="image/jpeg"
  133.            ;;
  134.     "jpeg") type="image/jpeg"
  135.             ;;
  136.     "jpg") type="image/jpeg"
  137.            ;;
  138.     "js") type="application/x-javascript"
  139.           ;;
  140.     "latex") type="application/x-latex"
  141.              ;;
  142.     "lha") type="application/octet-stream"
  143.            ;;
  144.     "lsf") type="video/x-la-asf"
  145.            ;;
  146.     "lsx") type="video/x-la-asf"
  147.            ;;
  148.     "lzh") type="application/octet-stream"
  149.            ;;
  150.     "m13") type="application/x-msmediaview"
  151.            ;;
  152.     "m14") type="application/x-msmediaview"
  153.            ;;
  154.     "m3u") type="audio/x-mpegurl"
  155.            ;;
  156.     "man") type="application/x-troff-man"
  157.            ;;
  158.     "mdb") type="application/x-msaccess"
  159.            ;;
  160.     "me") type="application/x-troff-me"
  161.           ;;
  162.     "mht") type="message/rfc822"
  163.            ;;
  164.     "mhtml") type="message/rfc822"
  165.              ;;
  166.     "mid") type="audio/mid"
  167.            ;;
  168.     "mny") type="application/x-msmoney"
  169.            ;;
  170.     "mov") type="video/quicktime"
  171.            ;;
  172.     "movie") type="video/x-sgi-movie"
  173.              ;;
  174.     "mp2") type="video/mpeg"
  175.            ;;
  176.     "mp3") type="audio/mpeg"
  177.            ;;
  178.     "mpa") type="video/mpeg"
  179.            ;;
  180.     "mpe") type="video/mpeg"
  181.            ;;
  182.     "mpeg") type="video/mpeg"
  183.             ;;
  184.     "mpg") type="video/mpeg"
  185.            ;;
  186.     "mpp") type="application/vnd.ms-project"
  187.            ;;
  188.     "mpv2") type="video/mpeg"
  189.             ;;
  190.     "ms") type="application/x-troff-ms"
  191.           ;;
  192.     "msg") type="application/vnd.ms-outlook"
  193.            ;;
  194.     "mvb") type="application/x-msmediaview"
  195.            ;;
  196.     "nc") type="application/x-netcdf"
  197.           ;;
  198.     "nws") type="message/rfc822"
  199.            ;;
  200.     "oda") type="application/oda"
  201.            ;;
  202.     "p10") type="application/pkcs10"
  203.            ;;
  204.     "p12") type="application/x-pkcs12"
  205.            ;;
  206.     "p7b") type="application/x-pkcs7-certificates"
  207.            ;;
  208.     "p7c") type="application/x-pkcs7-mime"
  209.            ;;
  210.     "p7m") type="application/x-pkcs7-mime"
  211.            ;;
  212.     "p7r") type="application/x-pkcs7-certreqresp"
  213.            ;;
  214.     "p7s") type="application/x-pkcs7-signature"
  215.            ;;
  216.     "pbm") type="image/x-portable-bitmap"
  217.            ;;
  218.     "pdf") type="application/pdf"
  219.            ;;
  220.     "pfx") type="application/x-pkcs12"
  221.            ;;
  222.     "pgm") type="image/x-portable-graymap"
  223.            ;;
  224.     "pko") type="application/ynd.ms-pkipko"
  225.            ;;
  226.     "pma") type="application/x-perfmon"
  227.            ;;
  228.     "pmc") type="application/x-perfmon"
  229.            ;;
  230.     "pml") type="application/x-perfmon"
  231.            ;;
  232.     "pmr") type="application/x-perfmon"
  233.            ;;
  234.     "pmw") type="application/x-perfmon"
  235.            ;;
  236.     "pnm") type="image/x-portable-anymap"
  237.            ;;
  238.     "pot") type="application/vnd.ms-powerpoint"
  239.            ;;
  240.     "ppm") type="image/x-portable-pixmap"
  241.            ;;
  242.     "pps") type="application/vnd.ms-powerpoint"
  243.            ;;
  244.     "ppt") type="application/vnd.ms-powerpoint"
  245.            ;;
  246.     "prf") type="application/pics-rules"
  247.            ;;
  248.     "ps") type="application/postscript"
  249.           ;;
  250.     "pub") type="application/x-mspublisher"
  251.            ;;
  252.     "qt") type="video/quicktime"
  253.           ;;
  254.     "ra") type="audio/x-pn-realaudio"
  255.           ;;
  256.     "ram") type="audio/x-pn-realaudio"
  257.            ;;
  258.     "ras") type="image/x-cmu-raster"
  259.            ;;
  260.     "rgb") type="image/x-rgb"
  261.            ;;
  262.     "rmi") type="audio/mid"
  263.            ;;
  264.     "roff") type="application/x-troff"
  265.             ;;
  266.     "rtf") type="application/rtf"
  267.            ;;
  268.     "rtx") type="text/richtext"
  269.            ;;
  270.     "scd") type="application/x-msschedule"
  271.            ;;
  272.     "sct") type="text/scriptlet"
  273.            ;;
  274.     "setpay") type="application/set-payment-initiation"
  275.               ;;
  276.     "setreg") type="application/set-registration-initiation"
  277.               ;;
  278.     "sh") type="application/x-sh"
  279.           ;;
  280.     "shar") type="application/x-shar"
  281.             ;;
  282.     "sit") type="application/x-stuffit"
  283.            ;;
  284.     "snd") type="audio/basic"
  285.            ;;
  286.     "spc") type="application/x-pkcs7-certificates"
  287.            ;;
  288.     "spl") type="application/futuresplash"
  289.            ;;
  290.     "src") type="application/x-wais-source"
  291.            ;;
  292.     "sst") type="application/vnd.ms-pkicertstore"
  293.            ;;
  294.     "stl") type="application/vnd.ms-pkistl"
  295.            ;;
  296.     "stm") type="text/html"
  297.            ;;
  298.     "sv4cpio") type="application/x-sv4cpio"
  299.                ;;
  300.     "sv4crc") type="application/x-sv4crc"
  301.               ;;
  302.     "svg") type="image/svg+xml"
  303.            ;;
  304.     "swf") type="application/x-shockwave-flash"
  305.            ;;
  306.     "t") type="application/x-troff"
  307.          ;;
  308.     "tar") type="application/x-tar"
  309.            ;;
  310.     "tcl") type="application/x-tcl"
  311.            ;;
  312.     "tex") type="application/x-tex"
  313.            ;;
  314.     "texi") type="application/x-texinfo"
  315.             ;;
  316.     "texinfo") type="application/x-texinfo"
  317.                ;;
  318.     "tgz") type="application/x-compressed"
  319.            ;;
  320.     "tif") type="image/tiff"
  321.            ;;
  322.     "tiff") type="image/tiff"
  323.             ;;
  324.     "tr") type="application/x-troff"
  325.           ;;
  326.     "trm") type="application/x-msterminal"
  327.            ;;
  328.     "tsv") type="text/tab-separated-values"
  329.            ;;
  330.     "txt") type="text/plain"
  331.            ;;
  332.     "uls") type="text/iuls"
  333.            ;;
  334.     "ustar") type="application/x-ustar"
  335.              ;;
  336.     "vcf") type="text/x-vcard"
  337.            ;;
  338.     "vrml") type="x-world/x-vrml"
  339.             ;;
  340.     "wav") type="audio/x-wav"
  341.            ;;
  342.     "wcm") type="application/vnd.ms-works"
  343.            ;;
  344.     "wdb") type="application/vnd.ms-works"
  345.            ;;
  346.     "wks") type="application/vnd.ms-works"
  347.            ;;
  348.     "wmf") type="application/x-msmetafile"
  349.            ;;
  350.     "wps") type="application/vnd.ms-works"
  351.            ;;
  352.     "wri") type="application/x-mswrite"
  353.            ;;
  354.     "wrl") type="x-world/x-vrml"
  355.            ;;
  356.     "wrz") type="x-world/x-vrml"
  357.            ;;
  358.     "xaf") type="x-world/x-vrml"
  359.            ;;
  360.     "xbm") type="image/x-xbitmap"
  361.            ;;
  362.     "xla") type="application/vnd.ms-excel"
  363.            ;;
  364.     "xlc") type="application/vnd.ms-excel"
  365.            ;;
  366.     "xlm") type="application/vnd.ms-excel"
  367.            ;;
  368.     "xls") type="application/vnd.ms-excel"
  369.            ;;
  370.     "xlt") type="application/vnd.ms-excel"
  371.            ;;
  372.     "xlw") type="application/vnd.ms-excel"
  373.            ;;
  374.     "xof") type="x-world/x-vrml"
  375.            ;;
  376.     "xpm") type="image/x-xpixmap"
  377.            ;;
  378.     "xwd") type="image/x-xwindowdump"
  379.            ;;
  380.     "z") type="application/x-compress"
  381.          ;;
  382.     "zip") type="application/zip"
  383.            ;;
  384.     "*") type="application/octet-stream"
  385.          ;;
  386. esac
  387. echo "$type"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement