Click here to Skip to main content
15,924,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: FileAttributes question Pin
Mazdak2-Jun-02 7:50
Mazdak2-Jun-02 7:50 
GeneralRe: FileAttributes question Pin
Rickard Andersson202-Jun-02 8:05
Rickard Andersson202-Jun-02 8:05 
GeneralRe: FileAttributes question Pin
ygxdha2-Jun-02 16:12
ygxdha2-Jun-02 16:12 
GeneralRe: FileAttributes question Pin
Rickard Andersson202-Jun-02 7:59
Rickard Andersson202-Jun-02 7:59 
GeneralRe: FileAttributes question Pin
Mazdak2-Jun-02 8:04
Mazdak2-Jun-02 8:04 
GeneralRe: FileAttributes question Pin
Rickard Andersson202-Jun-02 8:10
Rickard Andersson202-Jun-02 8:10 
GeneralRe: FileAttributes question Pin
ygxdha2-Jun-02 16:15
ygxdha2-Jun-02 16:15 
GeneralRe: FileAttributes question Pin
Humpo3-Jun-02 23:26
Humpo3-Jun-02 23:26 
i had a similar problem, i need to check if a file is a Directory, but ignore directory’s with System and/or Hidden attributes.

Thought my solution might be of some use if you need an example of how to check for more than one attribute. Also as i only started using C# 2 days ago maybe some expert can tell me if my solution is the best for what I’m trying to do, or if there is simpler method.


FileAttributes att = fsi[i].Attributes; //fsi = array of FileSystemInfo Smile | :)

bool bDirectory = (!((att & FileAttributes.Hidden) !=0) && // dont want hidden folders
((att & FileAttributes.Directory) !=0) &&
!((att & FileAttributes.System)!=0)); // dont want system folders

if(bDirectory)
//do something with fsi[i] - a directory Smile | :)

GeneralQuick Question Pin
Nick Parker2-Jun-02 6:17
protectorNick Parker2-Jun-02 6:17 
GeneralRe: Quick Question Pin
Rickard Andersson202-Jun-02 7:51
Rickard Andersson202-Jun-02 7:51 
GeneralRe: Quick Question Pin
Joshua Nussbaum2-Jun-02 21:41
Joshua Nussbaum2-Jun-02 21:41 
GeneralObject unknown Pin
sharon2-Jun-02 1:43
sharon2-Jun-02 1:43 
GeneralRe: Object unknown Pin
James T. Johnson2-Jun-02 12:14
James T. Johnson2-Jun-02 12:14 
GeneralPlatform Invoke .... Qn Pin
Kannan Kalyanaraman2-Jun-02 0:10
Kannan Kalyanaraman2-Jun-02 0:10 
GeneralRe: Platform Invoke .... Qn Pin
Nish Nishant2-Jun-02 0:20
sitebuilderNish Nishant2-Jun-02 0:20 
GeneralFocus Pin
Mazdak1-Jun-02 23:00
Mazdak1-Jun-02 23:00 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:22
sitebuilderNish Nishant2-Jun-02 0:22 
GeneralRe: Focus Pin
Mazdak2-Jun-02 0:29
Mazdak2-Jun-02 0:29 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:37
sitebuilderNish Nishant2-Jun-02 0:37 
GeneralRe: Focus Pin
Mazdak2-Jun-02 0:39
Mazdak2-Jun-02 0:39 
GeneralRe: Focus Pin
Nish Nishant2-Jun-02 0:36
sitebuilderNish Nishant2-Jun-02 0:36 
GeneralRe: Focus Pin
James T. Johnson2-Jun-02 12:21
James T. Johnson2-Jun-02 12:21 
GeneralRe: Focus Pin
Rocky Moore2-Jun-02 10:03
Rocky Moore2-Jun-02 10:03 
GeneralRe: Focus Pin
Mazdak2-Jun-02 10:14
Mazdak2-Jun-02 10:14 
GeneralRe: Focus Pin
James T. Johnson2-Jun-02 12:23
James T. Johnson2-Jun-02 12:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.