iOS get file size on disk

Posted by F2_CMD on Stack Overflow See other posts from Stack Overflow or by F2_CMD
Published on 2012-04-06T23:27:02Z Indexed on 2012/04/06 23:29 UTC
Read the original article Hit count: 170

Filed under:
|
|
|
|

I'm trying to get the size on disk of a file in iOS using Objective C. As of now I've been able to get the actual size of the file and other file information using NSFileManager and then getting the attributes attributesOfItemAtPath:error but not the size on disk. I also tried getting the file size from struct stat but again it doesn't give me size on disk.I tried using NSTask to make a call to du -h but iOS didn't allow me to fork other processes. Any ideas are welcome :)

I know this questions is similar to many others but the difference is that I'm trying to do this in iOS and most of the methods used in other systems don't work here.

Thanks

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about ios