0

I need to create a service in Visual studio 2010 and C# which will see periodically in a specified folder that any new file exists since last time It(Service) checked the folder. If there exist any file, It will get uploaded to pre defined destination.

I need to save the credentials to connect to ftp in db access as well.

What libraries, classes should I use for this. Please suggest.

Jeff Yates
  • 61,417
  • 20
  • 137
  • 189
DotnetSparrow
  • 27,428
  • 62
  • 183
  • 316
  • 4
    -1 You won't end up with a piece of software by posting a series of overly broad questions. Voting to close. – Ondrej Tucny Apr 20 '11 at 18:26
  • Please be more specific about the actual issues you are having. This is not answerable in its current state (Subjective and Argumentative). – Oded Apr 20 '11 at 18:26

3 Answers3

1

You technically don't need a service for this. Just have a job which starts a program on the machine and use the File System Watcher Object. When it realizes that files in the directory have changed, run the code to FTP the file to the specified location.

You can use this to execute your FTP commands: FTP Web Request

kemiller2002
  • 113,795
  • 27
  • 197
  • 251
0

Be careful with File System Watcher if you're expecting high volume. I'd suggest possibly using PInvoke and hooking up with change journals

0

Your requirements are very abstract, but i think its easy to formulate a solution for this.

Your application can be a windows form application for implementing the functionality, Directory methods should be of great help in getting the new file,once file is found you can use FtpWebRequest methods to upload the file.

Create a Scheduled Task in your control panel and schedule the application to run according to your requirement.

Venki
  • 1,419
  • 5
  • 28
  • 38
  • Hi @Morpheus Instead of using scheduled application using task scheduler, Isnt it better to create a windows service so that If I need to install it on multiple systems, Then I dont have to schedule it? – DotnetSparrow Apr 20 '11 at 18:42
  • @DotnetSparrow this should be of some help http://stackoverflow.com/questions/390307/windows-service-vs-scheduled-task – Venki Apr 20 '11 at 18:44
  • 1
    @DotnetSparrow I prefer scheduled task over windows service for this, I use windows service for applications interacting with database since its straightforward ftp upload i think scheduled task should do the trick! – Venki Apr 20 '11 at 18:47