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