title: Python - progress bar for copying and moving files
body: <p>I create a program which copy and move file to different direction. I was thinking that it would be interesting to add a progress bar to a whole process.
  How i should approach to it?</p>
  
  <p>My script do a few more thinks:</p>
  
  <p>Sort files with no .mdi file to a folder "missing mdi"</p>
  
  <p>I used distutils.dir_util.copy_tree because shutil.copytree had problem with acces</p>
  
  <pre><code>src = raw_input("Enter source disk location: ")
  src = os.path.abspath(src)
  dst = raw_input("Enter first destination : ")
  dst = os.path.abspath(dst)
  dest = raw_input("Enter second destination : ")
  dest = os.path.abspath(dest)
  
  for dir, dirs, files in os.walk(src):
  if any(f.endswith('.mdi') for f in files):
      dirs[:] = []  # do not recurse into subdirectories
      continue      # ignore this directory
  
  # do something with the files here, there are no .txt files.
  files = [os.path.join(dir, f) for f in files]
  print "files --&gt;", files
  
  for list in files:
  
  
      print "list ---&gt;", list
      #---------parameters-------------------#
      part1 = os.path.dirname(list)
      print "part1" ,part1
      part2 = os.path.dirname(os.path.dirname(part1))
      print "part2" ,part2
      part3 = os.path.split(part1)[1]
      print "part 3 -&gt;",part3
      path_miss1 = os.path.join(dst, "missing_mdi")
      print "path_miss1", path_miss1
      #---------first location-------------------#
      path_miss = os.path.join(path_miss1, part3)
      print "path_miss", path_miss
      #---------second location-------------------#
      path_missing = os.path.join(dest, "missing_mdi")
      print "path_missing", path_missing
  
  
      try:
          #---------first location-------------------#
          if not os.path.exists(path_miss):
              os.makedirs(path_miss)
          else:
              pass
  
          if os.path.exists(path_miss):
              distutils.dir_util.copy_tree(part1,path_miss)
          else:
              print "missing_file"
  
          if(get_size(path_miss)) == 0:
              os.rmdir(path_miss)
          else:
              pass
  
          #---------second location-------------------#
          if not os.path.exists(path_missing):
              os.makedirs(path_missing)
          else:
              pass
  
          if os.path.exists(path_missing):
              shutil.move(part1,path_missing)
          else:
              print "missing_file"
  
          if(get_size(path_missing)) == 0:
              os.rmdir(path_missing)
          else:
              pass
  
      except Exception, l:
          print "l ---&gt;",str  ( l )
  </code></pre>