FileSystemWatcher - How find out type (directory / file)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Here is another newbie question:

I am using the FileSystemWatcher. The filter I have set to "*.*". On the events, I get a FileSystemEventArgs object where I can get i.e. the name of the created/deleted/changed/renamed file or folder. But how do I find out first, if the object is a file or a directory?

Any hints are greatly appreciated.

Greets,

Phil
 
Hi Phil,

You can do this: Directory.Exists (e.FullPath) , if this returns true that
means you have created/deleted/changed/renamed a folder, and if it returns
false you have a file.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top