views:

88

answers:

3

I had assume I could just do this, but I don't have a way to check that resource forks went along for the ride.

NSFileManager *fm = [NSFileManager defaultManager];
[fm copyPath:absSourcePath toPath:absDestinationPath handler:err];

edit: I need to copy in a 10.4-6 compatible manner. (Yes, really 10.4.)

+3  A: 

Yes, everything gets copied, including file permissions, subdirectories, symbolic links, you name it. The documentation recommends using copyItemAtPath:toPath:error: in 10.5 and later, so you might want to work that in if possible. It's not available on 10.4, so you'll have to use copyPath:toPath:handler: there.

I guess I should note, it may depend on the destination filesystem; I don't know what would happen if it didn't support resource forks. I guess it would use Apple Double?

Carl Norum
A: 

I'm pretty sure this still works, but I haven't seen a file with a resource fork in some time, so I can't say for certain.

http://www.macosxhints.com/article.php?story=2002022409532098

Azeem.Butt
+3  A: 
neoneye
+1 for great comparison table! -1 for 10.5 while 10.4 was explicitely asked for.
Nikolai Ruhe
thanks. I haven't yet run any tests on 10.4 nor 10.6. A big comparison across different OS versions would indeed be nice. I will have to rethink some things.
neoneye