Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Launching a process based on file existence
Message
De
15/11/2011 13:50:27
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web Service
Divers
Thread ID:
01528855
Message ID:
01528947
Vues:
47
>Hello all,
>
>I wasn't sure how to classify this question, but I have a situation where I want to have a process (already written) run when a file is populated into a directory on my server. Basically, it is an import process that takes a file and loads it into the database. The file will be sent to the directory by partners via FTP.
>
>How should I create this? Should I create some kind of 'listener' process (if so, how is this accomplished?) that kicks off the import process when a file exists or create a console app that runs every minute or so and checks for the existence of said file in the directory and then run the import process when the file exists?
>
>If I do the latter, then this job will run over and over again to load a file that I get once a week.
>
>All suggestions are appreciated.
>
>TIA
>
>Bob

There is a Filewatcher class in .net I have found very useful for this kind of thing.

http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

Google it and you'll find many examples and explanations


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform