Robocopy based on extensions
<p>Currently I am using robocopy in python to copy out files based on extensions.</p>

<p>The code is below:</p>

<pre><code>call(["robocopy","C:\",dest,"*.7z","/S","/COPYALL"])
</code></pre>

<p>But in a scenario where there is no 7z files, it still creates the dest directory.</p>

<p>Is there a way to only create the directory and copy the file only if it exists?</p>

<p>Thanks in Advance</p>

<p>Why not check if there are 7z files before calling the copy utility?</p>

<pre><code>import glob
if glob.glob("*.7z"):
   call(["robocopy","C:\",dest,"*.7z","/S","/COPYALL"])
</code></pre>

python robocopy