I need an application developed in C#, .NET Core 2.1, which can behave as either a Windows Service or console application (windows/ubuntu linux).
Application will read app.config and act accordingly:
Application will, either as console or windows service, every ServiceIntervalInMinutes as configured:
1. Connect to Source FTP with protocol and credentials provided. Errors should be catch and saved to file in LogDirectory.
2. List files in Source FTP that don't start with SourceFTPChangeFileNamePrepend (because may be in transfer by another instance of app)
3. If there are files to be transfered, Connect to Destination FTP. Errors should be catch and saved to files in LogDirectory.
4. Foreach file to be transfered from Source to Destination:
4.1 If SourceFTPChangeFileNameBeforeTransfer = true, change filename in origin ftp, prepending SourceFTPChangeFileNamePrepend
4.2 Transfer file to Destination FTP server.
4.2.1 If file exists, act according to DestinationFTPActionIfFileExists
4.2.1 If Error, to file in LogDirectory and move to next file.
4.3 If DestinationFTPChangeFileNameAfterTransfer = true, rename destination file, removing DestinationFTPChangeFileNameRemovePrepend
4.4 If SourceFTPDeleteFileAfterTransfer = true, delete file from Source FTP
5. Gracefully disconnect from Source and Destination FTP.
Any error and exceptions should be catch and fully written to a unique filename (could have current-timestamp.log as name) in LogDirectory
Instructions need to be provided to:
1. Run/Install on Ubuntu Linux
2. Run/Install on Windows – As console app
3. Run/Install on Windows – As Windows Service
Model of app.config attached
Full source code, as Visual Studio project, is expected, along with executable build.