shutil moving files keeping the same directory structure
<p>I want to move a lot of files. the path to these files is stored in a list. I want to keep the whole directory structure but want to move them to a different folder.</p>

<p>So for example the files are 
D:\test\test1\test1.txt
D:\test\test1\test2.txt</p>

<p>I want to move them to C:\ from D:\ and keep the directory structure. How should I go about doing it?</p>

<p>this is the code i have, it is not working</p>

<pre><code>import os, fnmatch
import shutil


f=open('test_logs.txt','r') #logs where filenames are stored with filenames as first entry

for line in f:
    filename=line.split()
    output_file="C:" + filename[0].lstrip("D:")
    shutil.move(filename[0],output_file)
</code></pre>

<p>I read the file name fine and I can generate the destination filename fine but when I run it, it gives me an error saying "No such file or directory" (and gives the path of the output filename). </p>
