How can I tell if a file has finished being FTPed?

2019-04-10 05:36发布

We have a C# Windows service polling a folder waiting for an FTP’ed file to be posted in. To avoid using the file when it is still being written to we attempt to get a lock on the file first, however, there seems to be occasions where we are getting a lock on the file after the FTP’ed file is created but before the file is written to, so we end up opening an empty file.

Is there a reliable anyway to tell if the FTP is complete?

标签: c# file-io ftp
7条回答
迷人小祖宗
2楼-- · 2019-04-10 06:15

Rather than polling, you might want to have a look at System.IO.FileSystemWatcher.

查看更多
登录 后发表回答