Skip navigation.
 
mlRe: copyPath and performFileOperation
FROM : Michael Tsai
DATE : Tue Jan 28 01:19:17 2003

On Monday, January 27, 2003, at 06:01  PM, Lorenzo Puleo wrote:

> Hi Michael,
> thank you. May you write/paste some code explaining how to use ditto 
> via
> NSTask? I have never heard this.


For NSTask information, see

<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/Foundation/
ObjC_classic/Classes/NSTask.html
>

There's a man page for ditto, and you probably want to use some 
variation of:

ditto -rsrcFork src_file dst_file

The code would be something like:

NSString *path = @"/usr/bin/ditto";
NSArray *args = [NSArray arrayWithObjects:@"-rsrcFork", @"src_file", 
@"dst_file", nil];
NSTask *task = [NSTask launchedTaskWithLaunchPath:path arguments:args];
[task waitUntilExit];
// then check [task terminationStatus]...

> As ar as its limitation about copying
> Finder information, I use to apply Finder info via FSSetCatalogInfo, 
> so it's
> not a problem.


Not all the Finder information is stored in the catalog info. Of 
course, perhaps copying the catalog info is sufficient for your needs.

> Do you know some other limitation/bug/inconvenient (e.g. it doesn't 
> work on
> HFS standard, or on no-Mac File Systems, it's slow...) which could 
> refrein
> me of implementing this method?


ditto on 10.1 doesn't copy the catalog info, so you'd have to do that 
separately.

> For example, I know that copyPath API uses to fill the RAM with the 
> *whole*
> source file, so if you want to copy a 3GBytes file, you need minimum 
> 3GB
> free GBytes on your boot disk (which will be used as virtual memory). 
> So, in
> cases like this it's very very slow.


Yeah, I filed a bug on that. ditto's buffer is much smaller, in the 
hundreds of K. The performance is fine.

>  Also, if you copy a filePackage, later
> you still need to copy all the dates, finderInfo, permissions,... to 
> each
> file inside the destination filePackage.


I'm pretty sure ditto doesn't have that problem.

--Michael
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlcopyPath and performFileOperation Lorenzo Puleo Jan 27, 18:30
mlRe: copyPath and performFileOperation Michael Tsai Jan 27, 20:05
mlRe: copyPath and performFileOperation Lorenzo Puleo Jan 28, 00:01
mlRe: copyPath and performFileOperation Michael Tsai Jan 28, 01:19