I'm looking for the linux equivalent of the DOS command:

xcopy from/* to/* /s/e/d/y

Which copies over all new files and only replaces old ones. I'll be running this from the terminal of a Mac OSX computer.

  • If rsync is available on your platform, go for it! – gniourf_gniourf Oct 31 '13 at 15:25
  • "copies over all new files and only replaces old ones" - so it copies all files from directory from/, and overwrites files of same name that exist already in directory to/ ? – Joachim W Oct 31 '13 at 15:25
  • are /s and /e not contradictory? – Anthon Oct 31 '13 at 15:26
  • @Joachim It copies over any files that don't already exist at the target directory, and replaces older files at the target. – Matt Oct 31 '13 at 15:32

I normally use find for this:

cd from
find * -print0 | cpio -pdmv0 to/

Basically cp -f from/* to/. But I don't know the meaning of all the options to your DOS command; maybe you have to choose additional options here, man cp.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.