久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何將文件從 FTP 文件夾移動和替換到同一 FTP 中

How to move and replace files from FTP folder to another folder in same FTP(如何將文件從 FTP 文件夾移動和替換到同一 FTP 中的另一個文件夾)
本文介紹了如何將文件從 FTP 文件夾移動和替換到同一 FTP 中的另一個文件夾的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我正在嘗試將 FTP 位置中的一些 XML 文件移動到同一 FTP 中的另一個位置.我嘗試了以下代碼,但它不起作用.

I am trying to move some XML files in an FTP location to another location in the same FTP. I tried with the following code, but it doesn't work.

def ftpPush(filepathSource, filename, filepathDestination):
    try:
        ftp = FTP(ip, username, password)
        ftp.cwd(filepathDestination)
    
        ftp.storlines("STOR "+filename, open(filepathSource, 'r')) 
        ftp.quit()
        
        for fileName in os.listdir(path):
            if fileName.endswith(".xml"):
                ftpPush(filepathSource, filename, filepathDestination)
        
    except Exception, e:
        print str(e)
        
    finally:
        ftp.close()

推薦答案

要移動文件,請使用 FTP.rename.

To move a file use the FTP.rename.

假設 filepathSourcefilepathDestination 都是遠程文件,你這樣做:

Assuming that the filepathSource and the filepathDestination are both remote files, you do:

ftp.rename(filepathSource, filepathDestination)

這篇關于如何將文件從 FTP 文件夾移動和替換到同一 FTP 中的另一個文件夾的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權益,請聯(lián)系我們刪除處理,感謝您的支持!

相關文檔推薦

Why I cannot make an insert to Python list?(為什么我不能插入 Python 列表?)
Insert a column at the beginning (leftmost end) of a DataFrame(在 DataFrame 的開頭(最左端)插入一列)
Python psycopg2 not inserting into postgresql table(Python psycopg2 沒有插入到 postgresql 表中)
list extend() to index, inserting list elements not only to the end(list extend() 索引,不僅將列表元素插入到末尾)
How to add element in Python to the end of list using list.insert?(如何使用 list.insert 將 Python 中的元素添加到列表末尾?)
TypeError: #39;float#39; object is not subscriptable(TypeError:“浮動對象不可下標)
主站蜘蛛池模板: 日韩视频中文字幕 | 国产亚洲精品综合一区 | 一级片av | 久久久久久久久久久爱 | 日韩中文字幕 | 亚洲视频一区在线观看 | 国产一区三区在线 | 亚洲一区二区三区免费观看 | 91高清视频在线 | 丁香五月缴情综合网 | 国产精品一区二区久久久久 | 一级无毛片 | 国产一级片久久久 | 天天操天天玩 | 亚洲成人精选 | 国产福利一区二区 | 精品日韩一区二区三区av动图 | 日韩欧美视频网站 | 亚洲高清在线播放 | 日本久久精品 | 国产精品一区二区久久 | 日韩精品久久久久 | 国产精品美女久久久久aⅴ国产馆 | 欧美久久不卡 | 羞羞视频在线网站观看 | 国产美女久久久 | 日韩综合在线视频 | 中文在线视频观看 | 亚洲免费网 | 高清成人免费视频 | 国产成人精品网站 | 精品九九在线 | 日本精品一区二区三区视频 | 欧美日韩在线播放 | 免费的色网站 | 国产 欧美 日韩 一区 | 久久av一区二区三区 | 国内精品久久久久久 | 国产一级视频在线观看 | 国产高清视频在线 | 色婷婷综合网站 |