Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Securely copy resource forked files between Macs Network
I was recently trying to do a secure copy of a text clipping from one Mac to another Mac. When I first performed this with this command...
scp joe_blow@192.168.1.100:Desktop/foo.textClipping ~/Desktop/
...only the filename transfered over to the Mac, but the content was empty. That's because the text clipping keeps the actual text in the resource fork of the file.

So to solve this problem, I simply use the -E option in scp, and both the filename and resource forks are preserved. According to man scp, this only works if both Macs have 10.4 or later installed on their machines. You must also make sure you have ssh enabled. So this would look like the following:
scp -E joe_blow@192.168.1.100:Desktop/foo.textClipping ~/Desktop/
The :Desktop after the IP address means that Desktop is relative to the home user's account. For an absolute path use :/, followed by the path name. If you want to preserve the modification and access times as well as the content, then in addition use the -p option:
scp -Ep user@hostname:path path
Of course, these options can also be applied if you are sending a file using scp to a remote machine.
    •    
  • Currently 2.60 / 5
  You rated: 5 / 5 (5 votes cast)
 
[9,628 views]  

10.4: Securely copy resource forked files between Macs | 8 comments | Create New Account
Click here to return to the '10.4: Securely copy resource forked files between Macs' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Securely copy resource forked files between Macs
Authored by: macosx4me on Mar 01, '07 07:53:21AM

man rsync, man scp
Things are improved in 10.4.8 if you are not using ACLs.

I would not expect this to work to an earlier Mac OS X, nor to any non-Mac OS X system.



[ Reply to This | # ]
10.4: Securely copy resource forked files between Macs
Authored by: mkennard20 on Mar 01, '07 12:39:49PM

I actually use fugu for GUI secure copy.



[ Reply to This | # ]
Modification date changes
Authored by: ekc on Mar 01, '07 10:11:26AM

Sadly, as of 10.4.8, it seems scp -Ep still fails to preserve the modification date, at least for any file containing a resource fork. I wish Apple would fix this already! I have come up with a workaround, though.

ssh joe_blow@192.168.1.100 ditto -c Desktop/foo.textClipping "-" | ditto -x "-" ~/Desktop/

While ditto was meant for copying files around locally, you can pipe it through ssh to get files off a remote server. (I wrote a short script I call "rditto" which generates the above.) It does an excellent job with resource forks, mod dates, etc., and it even works in 10.3 (though you will need to add --rsrc to the ditto commands in that case).



[ Reply to This | # ]
Modification date changes
Authored by: macosx4me on Mar 02, '07 06:37:49AM

Apple's provided rsync does keep the mtime however.
And is better suited for what you seem to be doing.

Did you double-check your syntax ? Doesn't seem to work as stated (verbatim)



[ Reply to This | # ]
10.4: Securely copy resource forked files between Macs
Authored by: Occam on Mar 02, '07 10:05:50AM

Why not just zip any file before sending, it's quick and foolproof



[ Reply to This | # ]
10.4: Securely copy resource forked files between Macs
Authored by: ekc on Mar 03, '07 08:57:54AM
Why not just zip any file before sending, it's quick and foolproof

That will certainly work. I just wanted to point out that by piping your zip output, you can skip the interim step of creating an archive file before copying it.

That said, if you want to create a Finder-style zip archive from the command line, try:

ditto -ck --sequesterRsrc file_path file_path.zip
ditto -ck --sequesterRsrc --keepParent dir_path/ dir_path.zip

So you only need the --keepParent when you're compressing a folder instead of an individual file.

Expand with…

ditto -xk --sequesterRsrc path/archive.zip path/

…or by simply double-clicking in the Finder. (You won't need the --keepParent this time).



[ Reply to This | # ]
10.4: Securely copy resource forked files between Macs
Authored by: ekc on Mar 03, '07 08:33:13AM
Apple's provided rsync does keep the mtime however. And is better suited for what you seem to be doing.

Well, last I checked, rsync -E has the same issues as scp -E, and possibly even some extras according to what I've read here and there.

Did you double-check your syntax ? Doesn't seem to work as stated (verbatim)

Well, you would need to substitute joe_blow@192.168.1.100 and Desktop/foo.textClipping with whatever would be relevant in your case. I just used those in keeping with the original example.

By the way, it shouldn't be necessary to remember IP addresses like 192.168.1.100 if you give every computer a name in System Preferences → Sharing. Then you could write user@computer_name.local instead (making appropriate substitutions for the portions in italics). Bonjour/Rendezvous was supposed to spare us from memorizing IP addresses on the LAN.

Oh, one more thing I noticed in looking over my script is that when copying a folder instead of a file, I seem to be adding a --keepParent after the first ditto. I forget what that's all about…

[ Reply to This | # ]

10.4: Securely copy resource forked files between Macs
Authored by: dr_turgeon on Mar 07, '07 05:57:22AM
To get a working rsync go to:
http://www.onthenet.com.au/~q/rsync/

[ Reply to This | # ]