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 have few big folders "cosmo_sim_9", "cosmo_sim_10".... in one of my external hard disk, and a old copy of this on another external hard disk.

I want to Synchronize old directories with the new one(recursively), but without overwriting already existing files(for saving time).

How can I do this? My os is Fedora 20.

share|improve this question
up vote 7 down vote accepted

use rsync:

rsync -a --ignore-existing cosmo_sim_9 /dest/disk/cosmo_sim_9

--ignore-existing will cause it to skip existing files on the destination, -a will make it recursive, preserving if possible permission/ownership/group/timestamp/links/special devices.

you can do it for all directories by using a bash for loop:

for dir in cosmo_sim_* ; do
rsync -a --ignore-existing "$dir" "/dest/disk/$dir"
share|improve this answer

Using rsync can accomplish this. Based on the type of system you have, you will need to donwload it:

  • sudo yum install rsync (RPM Based)
  • sudo apt-get install rsync (Debian Based)

Then using this, here is the command you will need to use:

rsync -a source destination


rsync -r source destination

Where -r stands for copying data recursively (but don’t preserve timestamps and permission while transferring data.

-a stands for archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps

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.