Benches macOS

15

cp not working the same in 10.6.1 as it d…

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I on a new mac (10.6.1) that is pointed to an SMB server, that other older macs(10.4.x - 10.5.x) are using as an afp mount.

I need to run a shell command to copy some files

the command i run on 10.5.6 mac is

cp -Rp source destination

which copies the ._ files just fine.

the exact same command on the 10.6.1 mac skips the ._ files.

if i run the diff command

diff -qr soure destination is says that the destination directory is missing the ._ files.

can someone tell me how to get these files to move using the shell on a 10.6 mac?

Thanks,

C

15 replies

Sign in or join Beachball Help to reply.

  1. 0

    etresoft

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Wouldn't most people regard this change as a wonderful new feature of 10.6?

  2. 0

    Pendal

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    yes, but unfortunately I have 15 macs here than NEED those ._ files.

  3. 0

    twtwtw

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    according to the SL man page here, the -p option is supposed to copy extended attributes and resource forks. however, this man page seems to duplicate the 10.5.8 man page I have on my machine, so I'm wondering if maybe it hasn't been updated correctly? I'd suggest you play with the -p and -X options with a single file to see if you can get the effect you want, and either way report it as a bug (or at least the man page as out of date).

  4. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    according to the SL man page here, the -p option is supposed to copy extended attributes and resource forks.

    I suspect this was for files on an HFS+ file system where the resource fork and extended attributes are still part of the file.

    I suspect that once the Apple-Double format has been created, the
    cp command treats the individual parts are separate unrelated files.

    Maybe this is something you should ask Apple to address with a smarter
    cp command:

    <http://www.apple.com/feedback/macosx.html&gt;

    or

    <http://bugreporter.apple.com&gt;

    Free ADC (Apple Developer Connection) account needed for BugReporter

  5. 0

    Tony T1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Give rsync a try. It can be used to copy files, but use the current version, not the one supplied with Snow Leopard, (and include the fileflags.diff and crtimes.diff patches)

    see:
    http://samba.anu.edu.au/rsync/

    "Rsync is widely used for backups and mirroring +and as an improved copy command+ for everyday use."

    To compile for OS X:


    Download and unarchive rsync and its patches
    Move patches directory to rsync-3.0.?
    cd rsync-3.0.?
    Apply patches relevant to preserving Mac OS X metadata
    patch -p1 <patches/fileflags.diff
    patch -p1 <patches/crtimes.diff
    Configure, make, install
    ./prepare-source
    ./configure
    make
    sudo make install
    Verify your installation
    rsync --version
    By default, rsync will be installed in /usr/local/bin. If that isn't
    in your path, you will need to call your new version of rsync by its
    absolute path (/usr/local/bin/rsync).

  6. 0

    BobHarris

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    You might try rsync -E

  7. 0

    Tony T1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    In
    rsync 3.0 extended attributes has changed from -E to -X (best to use the options: -aNHAX --fileflags)

    -a archive mode; equals -rlptgoD (no -H,-A,-X)

    -N preserve create times (newness)

    -H preserve hard links

    -A preserve ACLs (implies -p)

    -X preserve extended attributes

  8. 0

    twtwtw

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    rsync version 2.x (which is what leopard and snow leopard package) does not handle resource files correctly. you need to get and install version 3.x

  9. 0

    Tony T1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    There is a problem with rsync 3.0.6 and creation times when compiled with x64 (default compile) in Snow Leopard. see: http://discussions.apple.com/thread.jspa?threadID=2145238&tstart=0 for discussion and fix.

  10. 0

    gearry

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Maybe set the shopt option "dotglob" to match .files with the * character:


    shopt -s dotglob
    mkdir -p /path/to/destination/source
    cp -Rp /path/to/source/* /path/to/destination/source

  11. 0

    Pendal

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks, I will try all of this tomorrow as I called in sick today.

    Just to let you know, I called apple friday afternoon before posting this.

    After being escalated several times, they proceeded to tell me that the Terminal.app is not intended for doing command line level requests but as a trouble shooting tool for them to use when something is not working correctly.

    They also told me that using the terminal.app as a command line tool is not part of the "Intended Use" for the OS X operating system and therefore is not covered under any support options.

    They then told me the only way to get support for the terminal.app was to contact one of the third party enterprise solution providers in my area, and perhaps they could help me.

    I really hope there is an option for simple inclusion of the ._ files in the terminal. I would hate to have to program a java based app, just for moving these files around.

    The real kicker is that if you use the terminal and do a ls -al on the directory, it SHOWS the ._ files. But try to cp them and no go!

    Arrgghh ...

  12. 0

    twtwtw

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    just as an observation about life, support call hierarchies are as follows:

    1. basic tech (the first guy you talk to): knows enough about computers to help total noobs, but is basically working from a script of predefined problems.

    2. go-to guy (second guy you talk to): knows more about computers than the first guy, but doesn't want to be too helpful (because he has other stuff to do, and doesn't want the basic techs dropping all their work on him)

    3. manager (third guy you'll get): knows almost nothing about computers - he's there for damage control, to get you off the phone without solving your problem and without making the company look stupid. I assume it was this guy that told you that terminal was not part of the 'intended use' of the OS? he
    ought to get fired for that, but he'll probably get a bonus.

    (p.s. sorry for using 'guy' all the time, but I don't believe I've ever gotten a woman when I called one of these support lines. interesting bit of gender dismorphia...)

    something like this, you should just file a bug report and leave it to the software engineers to mull over.

  13. 0

    Tony T1

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    You can also try ditto.

    ...but, I think that there may be something else to consider. In 10.6 Apple added
    HFS+ File Compression. The compressed data is added to the resource fork.

    ditto handles HFS+ File Compression.


    ditto will preserve resource forks and HFS meta-data information when
    copying unless instructed otherwise using --norsrc . Similarly, ditto
    will preserve extended attributes and Access Control Lists (ACLs) unless
    --noextattr or --noacl is passed. DITTONORSRC can be set in the environ-
    ment as an alias to --norsrc --noextattr --noacl on the command line.

  14. 0

    Jun T.

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    yes, but unfortunately I have 15 macs here than NEED those ._ files.

    Why do you need ._ files? Are you sure extended attributes are not copied?

    (or am I missing the point?)

    If you are copying from an AppleDouble volume to an HFS+ volume, then the contents of the ._files are copied into the extended attributes of the HFS+ file system; ._files need not be copied. If you copy from HFS to AppleDouble then ._files will be created (on the AppleDouble volume).

    If you copy a single file from AppleDouble to HFS+ by cp command (cp /Volumes/smb/afile .) then ._afile is not copied even on Leopard. If you copy a directory hierarchy (cp -Rp srcdir todir) from AppleDouble to HFS, then Leopard's cp command copies the contents of ._files into extended attributes
    and also copies the ._files themselves (unnecessarily). I think this was a bug of Leopard; on my 10.5.8 this causes a lots of messages like

    "error processing extended attributes : Operation not permitted"

    didn't you get these messages? Anyway now it is fixed in Snow Leopard.

    If copying from an AppleDouble volume to another AppleDouble volume, then the ._files are correctly copied by cp command of Snow Leopard.

    You can use xattr command to see the extended attributes of your files. Try

    $ xattr -h

    for how to use the command. The size of the resource fork of a file can be checked by

    $ ls -l filename/..namedfork/rsrc

  15. 0

    Pendal

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    {quote:title=Jun T. wrote:}

    Why do you need ._ files? Are you sure extended attributes are not copied?

    (or am I missing the point?)

    {quote}

    the cp command is part of a file management system that is moving the files from one network share (archives) to another network share (live work) and vice versa.

    All of the files are stored on a Windows 2003 Server Running XtremeIP to allow for the Macs to correctly connect and associate files.

    A byproduct of this is the the ._ files are written to the server in "Hidden" mode to allow the older (10.5 or older) macs to associate the files correctly.

    When the older macs connect to the server using AFP the ._ files are referenced but not seen.

    With 10.6 I am unable to connect using AFP (unless I am mistaken) and I must connect via SMB.

    If i were to connect to the network share on the older macs using SMB I loose all file associations and the macs do not know what to do with the files.

    Because the protocols changed in 10.6 SMB works correctly and the file associations work correctly.

    However, if I am copying files from one network share to another on the 10.6 mac it just skips over the ._ files, which the older macs need to understand the file associations.

    the cp command on the 10.5 machine works correctly and brings all files including the ._ files to the new location.

    the cp command in 10.6 does not.