"Get File Size"

Thu 05 July 2012

-(NSNumber *)getFileSize:(NSString *)fileName{

    NSError *error = nil;

    NSDictionary *attributes = [[NSFileManager defaultManager]

            attributesOfItemAtPath:fileName error:&error];

 

    if (!error) {

        NSNumber *size = [attributes objectForKey:NSFileSize];

        return size;

    } else {

        return [NSNumber numberWithFloat:-1];

    }

 

}