Benches macOS

6

Terminal Quesiton: cp -u or cp --update doesn't exist!?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Heya,

This is a general question that applies to any version of OSX that has the Terminal or Xterm app.

In most linux distros there is a *cp -u* or *cp --update* command which lets you overwrite files from one place to another IF the source file/directory is newer than the destination file/directory.

Is there anything similar in OSX? *man cp* reveals that the *-u, --update* command is not included in the OSX version of
cp.

I tend to backup one of my 2+ GB folders to Dropbox, but I don't want to have to backup the whole folder if I only updated a couple files.

Thanks!

6 replies

Sign in or join Beachball Help to reply.

  1. 0

    Kappy

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Unix and Linux are not the same, so it's not a good idea to assume that a Linux command or syntax will necessarily be the same in Unix.

    The standard backup utility for Darwin is rsync.

  2. 0

    lazyrussian

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks for the clarification.

    So what I'm trying to do is overwrite older files in Dropbox (www.getdropbox.com) with newer versions of my school files.

    Would I use: *rsync -u ~/Documents/School* ~/Dropbox/School*

    I checked the manual for it - I think that's the correct command. Is there something better?

  3. 0

    Allan Eckert

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hi lazyrussian;

    Since your questions are dealing with Unix, you really should post them in the Unix forum under Mac OS X Technologies. You will find the heavy weight Unix gurus there.

    Allan

    User uploaded file

  4. 0

    Kappy

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    I'm not sure what the rsync command would be for what you want to do, I think the line should be what you posted:

    rsync -u ~/Documents/School ~/Dropbox/School

    This assumes there is a folder named "Dropbox"

  5. 0

    lazyrussian

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hmm, *rsync -u --update* doesn't work the way I thought it would. It doesn't overwrite my files. It just skips the folder since the folder already exists, even after I modified a file in the source folder.

    I'll stick to *cp -r* until I get an answer from a unix/mac forum.

    Thanks for everyone's help!

  6. 0

    Kappy

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Maybe a revision in the command line to:

    rsync -u ~/Documents/School/* ~/Dropbox/School/*

    i think the above acts on the contents of the respective School folders rather than the folder itself. But I'm not an rsync aficionado so I'm not sure what the best construction should be. You may need to experiment until you discover the way it should work.