Posted By

romanos on 06/13/08


Tagged

folder directory


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

umang_nine


Is folder


 / Published in: C#
 

URL: http://www.jonasjohn.de/snippets/csharp/is-folder.htm

This is a little helper function to check whether a given path is a folder or a file.

  1. /// <summary>
  2. /// Returns true if the given file path is a folder.
  3. /// </summary>
  4. /// <param name="Path">File path</param>
  5. /// <returns>True if a folder</returns>
  6. public bool IsFolder(string path)
  7. {
  8. return ((File.GetAttributes(path) & FileAttributes.Directory) == FileAttributes.Directory);
  9. }

Report this snippet  

You need to login to post a comment.