Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

RashiMahajan

macrumors newbie
Original poster
Apr 17, 2009
22
0
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.
 
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.

Look at the NSFileManager documentation, particularly the fileAttributesAtPath method.
 
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 ?
 
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.
:)
 
Thanks sneha, i was also thinking the same way bt is there any API available whcih can abstract this info also
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.