Click here to Skip to main content
15,881,813 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just want to know there whether are any new files in the FTP site, and if a new file be uploaded in the FTP site, then I will download this file to local system. Could someone give me some suggestions?
Posted
Updated 27-Mar-12 4:17am
v2
Comments
eng.rania 27-Mar-12 10:46am    
can i use FileSystemWatcher to monitor FTP files?

 
Share this answer
 
Comments
eng.rania 27-Mar-12 10:41am    
thanks for your answer, but I need to watch the change on ftp files not in my local system.
[no name] 27-Mar-12 14:40pm    
That you are not hosting the FTP server is kind of need to know information
Sergey Alexandrovich Kryukov 27-Mar-12 12:46pm    
True, you cannot do it from the remote system through FTP.
--SA
Sergey Alexandrovich Kryukov 27-Mar-12 12:54pm    
However, I explained an alternative which can be used in addition to FTP (or instead of it), please see my answer.
--SA
Wonde Tadesse 27-Mar-12 19:53pm    
5+. Somehow it helps
This is just some extra info related to SAKryukovs' excellent answer.
FileSystemWatcher has some quirks that John Simmons uncovers in the following articles:
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^]
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^]

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Wonde Tadesse 27-Mar-12 19:54pm    
5+. Good CP reference.
Espen Harlinn 28-Mar-12 4:04am    
Thank you Wonde :-D
VJ Reddy 12-Jun-12 11:07am    
Good references. 5!
Espen Harlinn 12-Jun-12 11:09am    
Thank you, VJ :-D
Please see Solution 1 and my comment to it. You are right, you cannot do it. FTP is not designed the way to make it possible. Therefore, you can do it only if you use yet another service on your computer hosting the file in question.

If this is Windows OS, you can develop some Windows Service working by subscription. If a client of the service is subscribed by connection to the server, it can also pass the data on what part of file system. Internally, the service should use FileSystemWatcher and itself subscribe to the required events.

Please see my past answer to get an idea of such service:
Multple clients from same port Number[^].

For development of Windows Services, please start here:
http://msdn.microsoft.com/en-us/library/d56de412%28v=vs.100%29.aspx[^].

—SA
 
Share this answer
 
v3
Comments
Espen Harlinn 27-Mar-12 16:12pm    
Good points :-D
Sergey Alexandrovich Kryukov 27-Mar-12 16:12pm    
Thank you, Espen.
--SA
Wonde Tadesse 27-Mar-12 19:53pm    
5+
Sergey Alexandrovich Kryukov 27-Mar-12 21:20pm    
Thank you, Wonde.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900