Popular recipes tagged "shutil"http://code.activestate.com/recipes/tags/shutil/2015-02-06T09:45:12-08:00ActiveState Code Recipessmart copy (Python)
2015-02-06T09:45:12-08:00yotahttp://code.activestate.com/recipes/users/4184815/http://code.activestate.com/recipes/579020-smart-copy/
<p style="color: grey">
Python
recipe 579020
by <a href="/recipes/users/4184815/">yota</a>
(<a href="/recipes/tags/shutil/">shutil</a>).
</p>
<p>take a glob expression, a source directory and a destination directory to copy each files matching the glob in the appropriate directory</p>
<pre class="prettyprint"><code>glob = */*.txt
src_dir = ./a/b
dst_dir = /z/x/y
</code></pre>
<p>if the glob match a file <code>./a/b/c/foo.txt</code>, it will copy it in <code>/z/x/y/c/foo.txt</code> (and create the missing directory if needed)</p>
<p>Require Python3.4, code tab indented</p>