{"id":209,"date":"1997-09-09T01:36:29","date_gmt":"1997-09-09T09:36:29","guid":{"rendered":"http:\/\/www.birdhouse.org\/betips\/?p=209"},"modified":"1997-09-09T01:36:29","modified_gmt":"1997-09-09T09:36:29","slug":"set-filetypes-from-the-command-line","status":"publish","type":"post","link":"https:\/\/www.betips.net\/?p=209","title":{"rendered":"Set\n filetypes from the command line"},"content":{"rendered":"<p>There are two ways to establish a file&#8217;s type from the command line. The first is to use the <code>addattr<\/code> command, like this:<br \/>\n<code>addattr BEOS:TYPE text\/html filename(s)<\/code><br \/>\nThis works just fine when the file or files in question don&#8217;t yet have a filetype. If they do, the existing type will be overwritten with the new type.<br \/>\nTo achieve the same effect but with somewhat simpler syntax, try the <code>settype<\/code> command, which can be used with a <code>-t<\/code> flag to establish a MIME type, or with an <code>-s<\/code> flag to establish a signature. For example:<br \/>\n<code>settype -t text\/html filename(s)<\/code><br \/>\nFinally, you can use <code>-preferredAppSig preferred_app_signature<\/code> to change the preferred application with which the file is associated.<br \/>\nSettype is great for batch-changing type or preferred application on some criteria, as in this little script, which gives a new type to each of the resulting files turned up by a command-line query:<\/p>\n<pre>\nfor f in $(query \"query string here\" ) ;  do\n\tsettype -t \"new_type_here\"\ndone\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There are two ways to establish a file&#8217;s type from the command line. The first is to use the addattr command, like this: addattr BEOS:TYPE text\/html filename(s) This works just fine when the file or files in question don&#8217;t yet have a filetype. If they do, the existing type will be overwritten with the new [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[11],"class_list":["post-209","post","type-post","status-publish","format-standard","hentry","tag-terminal"],"_links":{"self":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209"}],"version-history":[{"count":0,"href":"https:\/\/www.betips.net\/index.php?rest_route=\/wp\/v2\/posts\/209\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.betips.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}