简体   繁体   中英

Get recent uploaded file from FTP

Is there any way in C# to get the recent uploaded file? Whenever a new file is uploaded to the FTP, a trigger should be raised that this is the new file that is added. I achieved it at a level using FtpWebRequest and WINSCP (check for new files which has last modified date with in 5 minutes) but there is a use case which is failing here. Lets say a file is modified last on 01/01/2018 and I uploaded this file on FTP today then as per its last modified date it wont be processed. Is there any way by which I can check which file is uploaded recently.

You can only use the information that the FTP server provides you with. And it won't tell you, what files were added. If you cannot use file modification time, you are out of luck. Except maybe if the server provides a file creation (not modification) timestamp. But I do not know of any major FTP server that does.

So all you can do, is to remember a list of files on the server and compare a current list again a previous one, to find what files were added.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM