1

I am working on an iphone application.

The application downloads images from the server and save them on the phone using the following

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath2 = [NSString stringWithFormat:@"%@/%@.png", documentsDirectory, fileName];

[UIImagePNGRepresentation(imageToSave) writeToFile:filePath2 atomically:YES];

My questions is:

Is there a way I can get the size of the folder it is saving in? because I am saving images and i want to keep track of its size. And when it exceeds a certain size I want to clear it. And how can I clear the images that I saved? should I loop on them one by one and remove? or can I clear directly the entire cached images?

thank you

Y2theZ
  • 10,162
  • 38
  • 131
  • 200
  • hi have you visited this link: http://stackoverflow.com/questions/9314954/ios-get-sum-of-filesize-in-directory – Arun Sep 24 '12 at 11:49

1 Answers1

0

refer following question : Easy way to get size of folder (ObjC/Cocoa)?

By this you can get the size of the folder. You can use NSFileManager to clear the contents of the path.

Community
  • 1
  • 1
V-Xtreme
  • 7,230
  • 9
  • 39
  • 79