Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 07-04-2010, 05:29 AM   #11 (permalink)
bordashell
Registered Member
 
Join Date: Jul 2010
Posts: 2
bordashell is on a distinguished road
Default

The following will clear the TMP directory used by the Simulator.

Code:
NSString *tempPath = NSTemporaryDirectory();
NSArray *dirContents = [[NSFileManager defaultManager] directoryContentsAtPath:tempPath];
NSArray *onlyJPGs = [dirContents filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"self ENDSWITH '.jpg'"]];

NSFileManager *fileManager = [NSFileManager defaultManager];

if (onlyJPGs) {	
	for (int i = 0; i < [onlyJPGs count]; i++) {
	NSLog(@"Directory Count: %i", [onlyJPGs count]);
	NSString *contentsOnly = [NSString stringWithFormat:@"%@%@", tempPath, [onlyJPGs objectAtIndex:i]];
	[fileManager removeItemAtPath:contentsOnly error:nil];
}
The above code clears only JPGs from the directory, so if you want to clear anything else then amend it.
bordashell is offline   Reply With Quote
 

» Advertisements
» Online Users: 366
13 members and 353 guests
alexP, baja_yu, blueorb, CMSLdesign, greeneye82, jimmyon122, mediaspree, taylor202, thebeast, TylerBetable, UconnAggie, veliata73
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,552
Threads: 94,078
Posts: 402,730
Top Poster: BrianSlick (7,990)
Welcome to our newest member, veliata73
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:08 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.