title: Unable to move mp4 files to another directory in ubuntu using python
body: <p>I am having difficulty moving mp4 files from one directory to another (Ubuntu Linux). The code i have included herewith seems to work perfectly when I move .py files between directory's.  I have done some research on Google searching for an answer but to no avail. i have found answers pointing to permissions etc and i have found help from the following urls. </p>
  
  <p><code>http://stackoverflow.com/questions/13193015/shutil-move-ioerror-errno-2-when-in-loop</code></p>
  
  <p><code>http://stackoverflow.com/questions/7432197/python-recursive-find-files-and-move-to-one-destination-directory</code></p>
  
  <p>I am new to python and just learning.  please can you assist with the code i have included and with the error message i get when i run my python script to move .mp4 files.</p>
  
  <p><code>sudo python defmove.py /home/iain/dwhelper /home/iain/newfolder .mp4</code></p>
  
  <p>(i am running the script from the directory where the defmove.py script resides and i have also made sure that newfolder does not exist prior to running defmove.py)</p>
  
  <pre><code>import os
  import sys
  import shutil
  
  def movefiles(src,dest,ext):
      if not os.path.isdir(dest):
          os.mkdir(dest)
              for root,dirs,files in os.walk(src):
                  for f in files:
                      if f.endswith(ext):
                           shutil.move(f,dest)
  
  def main():
      if len(sys.argv) != 4:
          print 'incorrect number of paramaters'
          sys.exit(1)
      else:
           src  = sys.argv[1]
           dest = sys.argv[2]
           ext  = sys.argv[3]
           movefiles(src,dest,ext)
  </code></pre>
  
  <p>main()</p>
  
  <pre><code>Traceback (most recent call last):
    File "defmove.py", line 24, in &lt;modeule&gt;
     main()
    File "defmove.py", line 22, in main
      movefiles(src,dest,ext)
    File "defmove.py", line 11, in movefiles
      shutil.move(f,dest)
    File "/usr/lib/python2.7/shutil.py", line 301, in move
      copy2(src, real_dst)
    File "/usr/lib/python2.7/shutil.py", line 130, in copy2
      copyfile(src,dest)
    File "/usr/lib/python2.7/shutil.py", line 82, in copyfile
      with open(src, 'rb') as fsrc:
  IOError: [Errno 2] No suck file or directory: 'feelslike.mp4'
  </code></pre>