Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSFileManager - Check file size?

I am recording sound file in one of my apps. I am trying to figure out how to get the file size of the recorded file?

I know how to get it and it's path, I just can not figure out how to get the file size.

Thanks Shani

like image 887
shannoga Avatar asked Jan 12 '12 23:01

shannoga


People also ask

How do I check the size of a file in Swift?

You can call . fileSize() on attr to get file size.

What does NSFileManager do?

The NSFileManager class provides convenient access to a shared file manager object that is suitable for most types of file-related manipulations. A file manager object is typically your primary mode of interaction with the file system. You use it to locate, create, copy, and move files and directories.


1 Answers

you can use :

- (NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error

to get the file property dictionary and can fetch [dictObject valueForKey: @"NSFileSize"];

like image 161
Saurabh Passolia Avatar answered Sep 26 '22 01:09

Saurabh Passolia