How to know the file Type in Iphone Directory

Discussion in 'iPhone/iPad Programming' started by RashiMahajan, Nov 16, 2009.

  1. macrumors newbie

    Joined:
    Apr 17, 2009
    #1
    HI,
    In my programm
    I am viewing all the files present at a location, Now i want to know the type of the file,that wether its a .png file,.jpg file,.doc or it is a folder? so that i will display a appropriate thumbnail next to it.
    Is there any way to know that whether its a file/folder or which type of file in objective C.
     
  2. macrumors regular

    Joined:
    Jun 18, 2008
    #2
    Look at the NSFileManager documentation, particularly the fileAttributesAtPath method.
     
  3. thread starter macrumors newbie

    Joined:
    Apr 17, 2009
    #3
    No file extension info

    But its display "NSFileTypeDirectory" or either "NSFileTypeRegular" as file type . It display NSFileTypeRegular for all jpg/png/doc/pdf file No way to knw the extension of the files ?
     
  4. macrumors newbie

    Joined:
    May 24, 2009
    Location:
    India
    #4
    You can read the files at the documents folder store it in some array
    and then using string separator you can separate the file name and the extension.
    :)
     
  5. thread starter macrumors newbie

    Joined:
    Apr 17, 2009
    #5
    Thanks sneha, i was also thinking the same way bt is there any API available whcih can abstract this info also
     
  6. macrumors newbie

    Joined:
    May 24, 2009
    Location:
    India
    #6
    They have not provided any API in the NSFileManager documentation at least. :rolleyes:
     

Share This Page