Mac Thread, How do you copy a folder and preserve ownership/permissions? in Technical; Fitted a new drive, copied a year groups folder over, now when I look at each pupils folder its defaulted ...
-
17th April 2008, 10:27 AM #1 How do you copy a folder and preserve ownership/permissions?
Fitted a new drive, copied a year groups folder over, now when I look at each pupils folder its defaulted to being owned by admin. I dont really want to go through them all again, so how can you copy and keep all permissions.
I assume its really easy to do with the command line but Im not that experianced with osx yet...is there a GUI way?
-
-
IDG Tech News
-
17th April 2008, 10:40 AM #2 Hmm...making a tar then moving it, then untar will preserve permissions.
Working off the top of my head but something like:
% tar cpf - inputdir | (cd /Users/someone/archive/stuff; tar xpf -)
should do it? (the p flag preserves permissons)
-
-
17th April 2008, 10:46 AM #3
-
-
17th April 2008, 10:50 AM #4 
Originally Posted by
DMcCoy
cp -p should do it
Really? Im not convinced that will work with Mac files (could be wrong but I would use the tar method to make sure.)
Last edited by sparkeh; 17th April 2008 at 10:53 AM.
-
-
17th April 2008, 11:03 AM #5 Well Ill try the cp method first
I cant seem to get anything to copy though, am I doing this right?
cp -p Constable Volumes/"Data 2"/Constable
I dont get any error messages from that, but nothing seems to copy either
When I type that Im in Volumes/Data 1 and Constable is the folder, Ive also created a folder called Constable on Data 2
-
-
17th April 2008, 11:04 AM #6 
Originally Posted by
sparkeh
Really? Im not convinced that will work with Mac files (could be wrong but I would use the tar method to make sure.)
it will even copy any ACLs and resource forks you may have, most of the unix tools have been modified on os x to support apple specific features.
-
-
17th April 2008, 11:13 AM #7 
Originally Posted by
DMcCoy
it will even copy any ACLs and resource forks you may have, most of the unix tools have been modified on os x to support apple specific features.
Oh from past experience, if cp comes across any files with resources then you can get problems, like resource forks being deleted. Perhaps things have changed.
Last edited by sparkeh; 17th April 2008 at 11:17 AM.
-
-
17th April 2008, 11:23 AM #8 
Originally Posted by
sidewinder
Well Ill try the cp method first
I cant seem to get anything to copy though, am I doing this right?
cp -p Constable Volumes/"Data 2"/Constable
I dont get any error messages from that, but nothing seems to copy either
When I type that Im in Volumes/Data 1 and Constable is the folder, Ive also created a folder called Constable on Data 2
Something like this if you want subfolders copied too
cp -p -R /Volumes/RAIDA/Custom /Volumes/RAIDB/
this copies the Custom folder from /Volumes/RAIDA/ to /Volumes/RAIDB
The -R is for recursive, but as sparkeh mentioned it will mess with things like links, as I don't have any on my user home folders I've moved all their data around a few times with cp.
-
-
17th April 2008, 11:33 AM #9 I should point out that this applies to 10.4 and above only. 10.3 unix tools don't copy resource forks and other things, so something like tar should be used (if it does support them in 10.3)
-
-
17th April 2008, 11:38 AM #10 Aha I was about to say, it all copied but permissions all set to default...and Im on 10.3
Will try the tar method then
At least Ive learned something new!
-
-
17th April 2008, 11:43 AM #11 
Originally Posted by
sidewinder
Aha I was about to say, it all copied but permissions all set to default...and Im on 10.3
Will try the tar method then
At least Ive learned something new!
Aparently according to wikipedia
"Until the advent of Mac OS X v10.4, the standard UNIX command line utilities in Mac OS X (such as cp and mv) did not respect resource forks. To copy files with resource forks, one had to use ditto or CpMac and MvMac."
I'm afraid 10.4 is *SO* much better than 10.3, with, well - everything. Much better AD support, ACLs etc. 10.3 is a bit rubbish
-
-
17th April 2008, 11:55 AM #12 
Originally Posted by
DMcCoy
Aparently according to wikipedia
"Until the advent of Mac OS X v10.4, the standard UNIX command line utilities in Mac OS X (such as cp and mv) did not respect resource forks. To copy files with resource forks, one had to use ditto or CpMac and MvMac."
I'm afraid 10.4 is *SO* much better than 10.3, with, well - everything. Much better AD support, ACLs etc. 10.3 is a bit rubbish

Yeah its frustrating, keep reading about different things but cant do any of it because we're on 10.3
New server on its way soon though with 10.5 so dont have to put up with it for long
-
-
17th April 2008, 12:04 PM #13 
Originally Posted by
DMcCoy
Aparently according to wikipedia
"Until the advent of Mac OS X v10.4, the standard UNIX command line utilities in Mac OS X (such as cp and mv) did not respect resource forks. To copy files with resource forks, one had to use ditto or CpMac and MvMac."
I'm afraid 10.4 is *SO* much better than 10.3, with, well - everything. Much better AD support, ACLs etc. 10.3 is a bit rubbish

Ah right yes, 10.3 was the last time I seriously used a Mac. Glad I'm not going mad
-
-
17th April 2008, 12:14 PM #14 oh ffs lol
Tried the tar method
All copied fine, but again no permissions!
I typed:
tar cpf - /Volumes/DATA1/Constable | (cd /Volumes/DATA2/tartest; tar xpf -)
Anything wrong with that?
(btw in case you're wondering I changed the volume names because I didnt want to keep having to put " round them)
-
-
17th April 2008, 12:22 PM #15 Ummmmm....
Are you doing this as root? Not clear that this would make a difference but worth a try?
-
SHARE:
Similar Threads
-
By FN-GM in forum Scripts
Replies: 2
Last Post: 23rd February 2008, 02:08 PM
-
By OutLawTorn in forum Scripts
Replies: 0
Last Post: 30th November 2007, 01:15 AM
-
By TechSupp in forum How do you do....it?
Replies: 2
Last Post: 5th October 2007, 10:38 PM
-
By sidewinder in forum Windows
Replies: 2
Last Post: 20th March 2007, 03:49 PM
-
By tosca925 in forum Windows
Replies: 6
Last Post: 20th October 2005, 06:48 PM
Thread Information
Users Browsing this Thread
There are currently 2 users browsing this thread. (0 members and 2 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules