Getting file system object type with FileSystemWatcher

  • Thread starter Thread starter Mo
  • Start date Start date
M

Mo

Hi,

I am watching a directory which has sub folders. in the
Filesystemchanged type Created I am trying to catch if the new object
is a file or a folder. How do I go about it? Also Is there a way to
get the subfolder of the file which was changed added or removed?

Thanks,
mo
 
Mo said:
Hi,

I am watching a directory which has sub folders. in the
Filesystemchanged type Created I am trying to catch if the new object
is a file or a folder. How do I go about it?

Call File.GetAttributes() on the path and check for the
FileAttributes.Directory flag.
Also Is there a way to
get the subfolder of the file which was changed added or removed?

I don't know what that means. Files don't have subfolders.

Pete
 

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