Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
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 Wuttke 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/
share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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