Google Search Query: how to know if a certain file is a folder in c#

Someone visited my site from google using the query: how to know if a certain file is a folder in c#I thought I would answer it because it is not on my site and I really belive that if people come to my site they should have a chance to find what they are looking for.Basically, there is a class called “File” in the System.IO namespace, this class exposes a lot of static methods, one of them is GetAttributes [File.


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan

<p>Someone visited my site from google using the query: how to know if a certain file is a folder in c#<p />I thought I would answer it because it is not on my site and I really belive that if people come to my site they should have a chance to find what they are looking for.<p />Basically, there is a class called "File" in the System.IO namespace, this class exposes a lot of static methods, one of them is GetAttributes [File.GetAttributes(<em>string pathName</em>)]. This static method returns a FileAttributes Enumeration which in turn has a property "Directory". If the file specified by the PathName parameter is a Directory then the enumeration can be logically tested by performing the following boolean statement.<p />((File.GetAttributes(path) & FileAttributes.Directory) == FileAttributes.Directory<p />This statement will logically [not conditionally] AND the enumeration with the Directory Attribute on the enumeration, this will leave the enumeration with only the Directory Flag set if it is already set, which can then be tested against the attribute directly. The enumeration is probably specified with the Flags attribute.<p /></p>


This content originally appeared on Modern Web Development with Chrome and was authored by Paul Kinlan


Print Share Comment Cite Upload Translate Updates
APA

Paul Kinlan | Sciencx (2005-11-18T00:00:00+00:00) Google Search Query: how to know if a certain file is a folder in c#. Retrieved from https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/

MLA
" » Google Search Query: how to know if a certain file is a folder in c#." Paul Kinlan | Sciencx - Friday November 18, 2005, https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/
HARVARD
Paul Kinlan | Sciencx Friday November 18, 2005 » Google Search Query: how to know if a certain file is a folder in c#., viewed ,<https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/>
VANCOUVER
Paul Kinlan | Sciencx - » Google Search Query: how to know if a certain file is a folder in c#. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/
CHICAGO
" » Google Search Query: how to know if a certain file is a folder in c#." Paul Kinlan | Sciencx - Accessed . https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/
IEEE
" » Google Search Query: how to know if a certain file is a folder in c#." Paul Kinlan | Sciencx [Online]. Available: https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/. [Accessed: ]
rf:citation
» Google Search Query: how to know if a certain file is a folder in c# | Paul Kinlan | Sciencx | https://www.scien.cx/2005/11/18/google-search-query-how-to-know-if-a-certain-file-is-a-folder-in-c/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.