How to move file from one folder to another folder same ftp using python
<p>How move files from one folder to another folder in same ftp using python 
i used this code but it doesn't work out </p>

<pre><code>ftp=FTP("host")
ftp.login("user name","password")
def downloadFiles(path,destination):
    try:
        ftp.cwd(path)
         #clone path to destination
        ftp.dir(destination)
        #~ os.mkdir(destination[0:len(destination)-1]+path)
        print destination[0:len(destination)-1]+path+" built"
    except OSError:
        #folder already exists at destination
        pass
    except ftplib.error_perm:
        #invalid entry (ensure input form: "/dir/folder/something/")
         print "error: could not change to "+path
         sys.exit("ending session")

    filelist=ftp.nlst()

    for file in filelist:
         try:
             #this will check if file is folder:
             ftp.cwd(path+file+"/")
             #if so, explore it:
             downloadFiles(path+file+"/",destination)

         except ftplib.error_perm:
             #not a folder with accessible content
             #download &amp; return
             #~ os.chdir(destination[0:len(destination)]+path)
             #possibly need a permission exception catch:
             #~ ftp.retrbinary("RETR "+ file, open(ftp.path.join(destination,file),"wb").write)
             ftp.storlines("STOR "+file, open(ftp.dir(destination, file),'r')) 
             print file + " downloaded"
    return
</code></pre>

<p>I would suggest using the excellent python file system abstraction <a href="https://pypi.python.org/pypi/fs" rel="nofollow">pyfs</a> as you can see from the <a href="http://docs.pyfilesystem.org/en/latest/interface.html" rel="nofollow">documents</a> all of the file systems, once mounted, have <code>copy</code>, <code>copydir</code>, <code>move</code> and <code>movedir</code> methods, <em>personally I would always copy, verify then delete for safety especially on a remote system.</em></p>

python ftp