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

監控遠程FTP目錄

Monitor remote FTP directory(監控遠程FTP目錄)
本文介紹了監控遠程FTP目錄的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我只能通過 FTP 訪問遠程服務器上的目錄,并且希望在新文件出現在目錄中時立即獲取它們的內容.

I only have FTP access to a directory on a remote server and would like to get the contents of new files as soon as they appear in the directory.

有沒有類似 FAM for Python 的東西可以讓我通過 FTP 監控新文件?

Is there any thing like FAM for Python that lets me monitor for new files over FTP?

推薦答案

如果輪詢服務器是一個選項:

If polling the server is an option:

from ftplib import FTP
from time import sleep

ftp = FTP('localhost')
ftp.login()

def changemon(dir='./'):
    ls_prev = set()

    while True:
        ls = set(ftp.nlst(dir))

        add, rem = ls-ls_prev, ls_prev-ls
        if add or rem: yield add, rem

        ls_prev = ls
        sleep(5)

for add, rem in changemon():
    print('
'.join('+ %s' % i for i in add))
    print('
'.join('- %s' % i for i in remove))

ftp.quit()

這篇關于監控遠程FTP目錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

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:“浮動對象不可下標)
主站蜘蛛池模板: 永久免费看mv网站入口亚洲 | 亚洲黄色小视频 | 一级黄色性生活片 | 香蕉成人网 | 国产精品久久久久久久久久久久午夜片 | 日韩欧美一级片 | 亚洲69视频 | 久久久久久亚洲精品 | 中文字幕不卡在线 | 97久久久久 | 黄色免费一级片 | 黄色一级免费 | 在线国产91 | 福利视频网址 | 亚洲成人免费网站 | 日韩三级精品 | 日韩av在线免费播放 | 韩国精品一区 | 日本中文在线观看 | 日日不卡av | 日韩一区在线视频 | 亚洲久久久 | 免费色片 | 亚洲男人天堂网 | 欧美黄色片在线观看 | 亚洲精品成人在线 | 欧美综合视频 | 特级丰满少妇一级aaaa爱毛片 | 色婷婷影院 | h片免费| 美女视频福利 | 一级片日韩 | 91久久综合亚洲鲁鲁五月天 | 九九色 | 精品视频在线播放 | 久久精品一区二区三区不卡牛牛 | 成av人片一区二区三区久久 | 黄色欧美视频 | 国产美女视频网站 | 久草网在线观看 | 国产午夜一区二区 |