snipt

Ctrl+h for KB shortcuts

Bash

Zips up each subdir into its own archive.

for f in `find . \( ! -name . -prune \) -type d -print`; do zip $f.zip $f; done
https://snipt.net/embed/440e8655eed928b8228af5de2d290ed6/
/raw/440e8655eed928b8228af5de2d290ed6/
440e8655eed928b8228af5de2d290ed6
bash
Bash
1
2019-06-14T18:44:12
True
False
False
/api/public/snipt/4242/
zips-up-each-subdir-into-its-own-archive
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="k">for</span> f in <span class="sb">`</span>find . <span class="se">\(</span> ! -name . -prune <span class="se">\)</span> -type d -print<span class="sb">`</span><span class="p">;</span> <span class="k">do</span> zip <span class="nv">$f</span>.zip <span class="nv">$f</span><span class="p">;</span> <span class="k">done</span> </span></pre></div> </td></tr></table>
bash, directory, find, zip