Thread: Finding out if its a directory or not

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    5

    Finding out if its a directory or not

    Hi guys...

    Is there a way to check the files my program returns when it scans through the c drive are folders/directorys or something complete different say a text file or a .exe program. I figure i can check the ending of the file name to see if it matches .txt or .exe but surely theres an easier way of checking if its a directory or not as in the end i'll want the program to open each directory it comes across and check in there for a pre set file.

    Cheers Mike...

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    162
    Are you using the winAPI functions FindFirstFile() and FindNextFile()? Becouse if you are then you should have WIN32_FIND_DATA structure with a dwFileAttributes variable member that should be set with the FILE_ATTRIBUTE_DIRECTORY flag if the file is a directory.
    We haven't inherited Earth from our parents; instead we have borrowed her from our children - old Indian saying.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  2. Finding files in a directory
    By smarta_982002 in forum C Programming
    Replies: 1
    Last Post: 01-25-2008, 10:10 AM
  3. Finding the desktop's directory.
    By Queatrix in forum Windows Programming
    Replies: 4
    Last Post: 08-19-2005, 07:25 PM
  4. Finding out the name of a file, and changing directory
    By nindoja in forum C Programming
    Replies: 17
    Last Post: 06-22-2004, 09:49 PM
  5. Finding a directory, and printing whats in it
    By booyah in forum C Programming
    Replies: 4
    Last Post: 11-12-2003, 11:52 AM