Why would you delete files in this manner? It's more efficient to delete them 
directly from your Objective C code, thus:

    NSArray *fileArray = [@"path1",@"path2"];
    for (NSString *filename in fileArray)
    {
        [fileMgr removeItemAtPath:filename error:NULL];
    }

You already know what paths you need to use…

I hope that this helps.


On 26 Nov 2013, at 15:47, koko <k...@highrolls.net> wrote:

> 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 (Cocoa-dev@lists.apple.com)
> 
> 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/45rpmlists%40googlemail.com
> 
> This email sent to 45rpmli...@googlemail.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to