I need to remove hidden files from removable media and have been doing so
successfully until 10.9.
I use NSTask as follows:
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:rootScriptPath];
[task setArguments:[NSArray arrayWithObjects:rootpath, nil]];
[task waitUntilExit];
[task launch];
[task release];
where rootScriptPath is from:
NSString *rootScriptPath = [[NSBundle mainBundle]
pathForResource:@"DeleteHiddenRoot" ofType:nil];
and DeleteHiddenRoot is:
#!/bin/sh
rm -dfR "$1".f*
rm -dfR "$1"._*
rm -dfR "$1".DS*
rm -dfR "$1".S*
chmod ugo+rw "$1".Trashes
rm -dfR "$1".T*
finally, rootpath is from:
NSArray *pathComponents = [[NSString stringWithCString:(const char*)dir
encoding:NSASCIIStringEncoding] pathComponents];
NSString *mediapath = [pathComponents objectAtIndex:0];
mediapath = [mediapath stringByAppendingPathComponent:[pathComponents
objectAtIndex:1]];
mediapath = [mediapath stringByAppendingPathComponent:[pathComponents
objectAtIndex:2]];
NSString *rootpath = [mediapath stringByAppendingString:@"/"];
This works just fine up to and including 10.8.5 BUT throws an exception at
[task launch] on 10.9
Google reveals nothing about this … at first I thought that sh was not
available but in Terminal on 10.9 entering !#/bin/sh puts you into sh
any help is much appreciated … !
-koko
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]