2

If I use cp in archive mode e.g

cp -a /my_old_directory/* /new_location/my_new_directory/

to replicate a directory structure and all that is in it.

If I then run the same command again will any changed files be refreshed or over-written or skipped?

(I know rsync is more advanced at this kind of thing, I'm just curious about cp -a as I can't find any description of what it actually does in this case.

2 Answers 2

4

cp will overwrite all files.

what you are looking for if you do not want that behavior is the rsync command.

the -a option just means it will preserve the source file metadata, like creation time, owner, access mode and such..

1

Existing files will be over-written, as somewhat implied in gilles' answer to Difference between cp -r and cp -a.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.