title: How to move files in multiple directories into another directory with same sub directoies
body: <p>I have</p>
  
  <pre><code>import shutil
  
  for sub_dir in os.listdir(path + "train"):
      src_files = os.listdir(path+"train/" + sub_dir)
      ...
      for file in src_files[0:split_index]:
          original = path+"train/" + sub_dir+ "/" + file
          distutils.dir_util.mkpath(path + "valid/" + sub_dir)     
          destination = path + "valid/" + sub_dir+"/"
          shutil.move(original, destination)
  </code></pre>
  
  <p>I have two these directory structures:</p>
  
  <pre><code>train/abc
  train/def
  train/ghi
  
  valid/
  </code></pre>
  
  <p>I need to move some portion of files in train/ to valid/ and retain the original directory structure. After the move, valid/ should look the same as train/:</p>
  
  <pre><code>valid/abc
  valid/def
  valid/ghi
  </code></pre>
  
  <p>The above code isn't quite right. How can I modify it to make it right?</p>