{"id":337,"date":"2013-03-21T22:26:40","date_gmt":"2013-03-21T21:26:40","guid":{"rendered":"http:\/\/www.carinato.net\/?p=337"},"modified":"2013-03-21T22:26:40","modified_gmt":"2013-03-21T21:26:40","slug":"zip-puliti-con-mac-os-x","status":"publish","type":"post","link":"https:\/\/carinato.com\/?p=337","title":{"rendered":"ZIP Puliti con Mac OS-X"},"content":{"rendered":"<p>Comprimendo una cartella con il vostro PC Mac avrete notato che vengono inclusi anche dei file nascosti tipo&nbsp;<\/p>\n<pre class=\"p1\">.svn\n.git\n.DS_Store\nThumbs.db<\/pre>\n<p>Ecco come risolvere il problema in 2 minuti:<\/p>\n<p>Aprite l&#39;applicazione Automator<\/p>\n<p>Alla richiesta del modello da creare selezionate Servizio e confermate con il tasto Scegli<\/p>\n<p>In alto come ricezioni impostate &quot;Documenti e Cartelle&quot; in &quot;Finder&quot;<\/p>\n<p>Dall&#39;elenco sulla sinistra selezionate dalla categoria &quot;Utility&quot; l&#39;azione &quot;Esegui Apple Script&quot; e trascinatela nell&#39;area di destra<\/p>\n<p>Troverete gia&#39; scritto del codice di esempio :<\/p>\n<pre>on run {input, parameters}\n    (* Your script goes here *)\n    return input\nend run<\/pre>\n<p>Cancellate tutto e incollate il codice seguente:<\/p>\n<pre>on run {input, parameters}\n    tell application &quot;Finder&quot;\n        set n to count of input\n        set oggetto to (first item of input as string)\n        set Dir to ((container of item oggetto) as string)\n        set cartella to quoted form of POSIX path of Dir\n        set nome to &quot;&quot;\n        repeat with i in input\n            set nome to (quoted form of ((name of i) as string) &amp; &quot; &quot; &amp; nome)\n        end repeat\n        if n = 1 then\n            set nome_se to my nome_senza_estensione(oggetto)\n        else\n            set nome_se to &quot;Archivio&quot;\n        end if\n        if item (Dir &amp; nome_se &amp; &quot;.zip&quot;) exists then\n            set theDate to current date\n            set theYear to year of theDate as text\n            set theMonth to (month of theDate as integer) as text\n            if length of theMonth &lt; 2 then\n                set theMonth to (&quot;0&quot; &amp; theMonth)\n            end if\n            set theDay to (day of theDate) as text\n            if length of theDay &lt; 2 then\n                set theDay to (&quot;0&quot; &amp; theDay)\n            end if\n            set theTime to (characters 1 thru 2 of time string of theDate) &amp; (characters 4 thru 5 of time string of theDate) &amp; (characters 7 thru 8 of time string of theDate)\n            set nome_se to (nome_se &amp; &quot;_&quot; &amp; theYear &amp; theMonth &amp; theDay &amp; &quot;-&quot; &amp; theTime)\n        end if\n        do shell script &quot;cd &quot; &amp; cartella &amp; &quot;; zip -r --exclude=*.DS_Store* --exclude=*.svn* --exclude=*.git* --exclude=*Thumbs.db* &quot; &amp; quoted form of nome_se &amp; &quot; &quot; &amp; nome \n    end tell\n    return input\n    \nend run\n\non nome_senza_estensione(an_item)\n    tell application &quot;Finder&quot;\n        set theName to (name of item an_item) as text\n        set theExtension to (name extension of item an_item) as text\n        if theExtension is not &quot;&quot; then\n            set x to the offset of theExtension in theName\n            set theName to text 1 thru (x - 2) of theName\n        end if\n        return theName\n    end tell\nend nome_senza_estensione<\/pre>\n<p>Ora salvare il tutto ed assegnare un nome appropriato al Servizio, es: &quot;Crea Zip Pulito&quot;<\/p>\n<p>A questo punto &quot;cliccando col tasto destro&quot; su una cartella oppure su un insieme di file troverete la funzione &quot;Crea Zip Pulito&quot; che generer&agrave; un archivio di tipo .zip senza i classici file nascosti generati da OS-X&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Comprimendo una cartella con il vostro PC Mac avrete notato che vengono inclusi anche dei file nascosti tipo&nbsp; .svn .git .DS_Store Thumbs.db Ecco come risolvere il problema in 2 minuti: Aprite l&#39;applicazione Automator Alla richiesta del modello da creare selezionate Servizio e confermate con il tasto Scegli In alto come ricezioni impostate &quot;Documenti e Cartelle&quot; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"class_list":["post-337","post","type-post","status-publish","format-standard","hentry","category-mac"],"_links":{"self":[{"href":"https:\/\/carinato.com\/index.php?rest_route=\/wp\/v2\/posts\/337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/carinato.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/carinato.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/carinato.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/carinato.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=337"}],"version-history":[{"count":0,"href":"https:\/\/carinato.com\/index.php?rest_route=\/wp\/v2\/posts\/337\/revisions"}],"wp:attachment":[{"href":"https:\/\/carinato.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/carinato.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/carinato.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}