久久久久久久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:“浮動對象不可下標)
主站蜘蛛池模板: 国产精品99久久久久久久久 | 国产特级毛片aaaaaa喷潮 | 日一区二区 | 国产精品免费福利 | 网色| 国产高清视频一区二区 | 男女在线免费观看 | 91在线网 | 国产精品午夜电影 | 天天草狠狠干 | 91精品国产高清一区二区三区 | 欧美国产日韩在线观看 | 天天艹天天干天天 | 久草热线 | 日本视频一区二区 | 日韩精品一区中文字幕 | 欧美v在线 | 国产精品久久久亚洲 | 亚洲综合无码一区二区 | 久久国产精品一区二区三区 | 久久尤物免费一区二区三区 | 欧美日韩国产一区 | 亚洲中午字幕 | 亚洲国产精品美女 | 国产在线视频三区 | 亚洲高清一区二区三区 | 日韩精品视频在线观看一区二区三区 | 日日骚av| 国产精品日女人 | 另类 综合 日韩 欧美 亚洲 | 久久影音先锋 | 欧美综合视频在线 | 免费中文字幕 | 视频一二区 | 亚洲精品日韩在线 | 日本一区二区高清不卡 | jizz18国产| 精品免费视频 | 久久一区精品 | 国产日产欧产精品精品推荐蛮挑 | 久久91精品 |