How to execute code in c# service one time per day at the same hour?

后端 未结 6 1542
天涯浪人
天涯浪人 2020-12-09 12:53

So here\'s my problem, I need to do a c# service running on a server who\'s getting file on ftp one time per day at 3am. I think that I can do it with a thread.sleep() or by

6条回答
  •  隐瞒了意图╮
    2020-12-09 13:42

    If you are expecting a file every night, instead of worrying about when it arrives, just get an event fired when it does.

    Look at:

    System.IO.FileSystemWatcher

    File System Watcher on MSDN

提交回复
热议问题