Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I know changes of folder's content? Such as: New file(s) or folder(s) are create, modify, delete... ?
Posted

From MSDN[^]
Use FileSystemWatcher[^] to watch for changes in a specified directory. You can watch for changes in files and subdirectories of the specified directory. The component can watch files on a local computer, a network drive, or a remote computer.

Check a similar article here:
C#: Application to Watch a File or Directory using FileSystem Watcher[^].
Also check : How to: Get Information About Files, Folders, and Drives (C# Programming Guide)[^]


--Amit
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 13-Jun-13 2:23am    
Right, a 5. We've been writing it in parallel. I also answered, but added something troublesome; it worth looking it, please see Solution 2.
—SA
_Amy 13-Jun-13 2:24am    
Thank you Sergery. :)
Nguyễn Minh Phúc 13-Jun-13 2:59am    
Thank you Admit!
Sergey Alexandrovich Kryukov 13-Jun-13 11:50am    
Are you going to accept any or both of our solutions formally then (green button)?
—SA
Espen Harlinn 13-Jun-13 17:49pm    
5'ed!
If you want to capture related events, you can use the class System.IO.FileSystemWatcher:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^].

However, here is some warning for you:
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^],
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^].

—SA
 
Share this answer
 
Comments
_Amy 13-Jun-13 2:24am    
+5!
Sergey Alexandrovich Kryukov 13-Jun-13 2:25am    
Thank you, Amit.
—SA
Nguyễn Minh Phúc 13-Jun-13 2:58am    
Thank you Sergey!
Sergey Alexandrovich Kryukov 13-Jun-13 3:07am    
You are welcome. Will you accept the answer (or both answers) formally (green button)?
—SA
Espen Harlinn 13-Jun-13 17:50pm    
5'ed!

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