Incremental scan of new/modified FTP files with C#

不想你离开。 提交于 2021-02-08 08:53:20

问题


I have an FTP server from which I need to upload files to a blob storage in Azure. I cannot touch or move any of the files. Is there anyway to do an incremental scan (through an id or similar), or do you have to save the modified date of the newest file and then scan all files newer than that? All input are welcome.


回答1:


All you can do with FTP is to get a list of all files in a directory. Nothing else.

Some FTP servers will allow you retrieving the list sorted by a timestamp. This is a proprietary non-standard extension. See How to get files in FTP folder sorted by modification time. But it still won't save you from requesting a listing of all files (though you may abort the list download prematurely, once you get all files you need).

There's no way to ask an FTP server to return only "new files", no matter what's your definition of that.

If you need anything fancy, you will have to build a service on the server (server as a machine, not server as an FTP server) itself with an API that will do what you need.



来源:https://stackoverflow.com/questions/59790976/incremental-scan-of-new-modified-ftp-files-with-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!