Wednesday, February 15, 2012

Skip duplicate files with copy (cp)

Skip duplicate files with copy (cp): "This isn't as elegant as I think you are looking for, but could you use the update flag?

cp -u

--update
copy only when the SOURCE file is newer than the destination
file or when the destination file is missing


You would have to be a bit careful just because it just looks at the timestamp, but will at least you won't have to sit in front of the terminal and babysit the copy.


----

I also found this but have never used it. However, it may be what you are looking for.

`--reply=HOW'
*Deprecated: to be removed in 2008.*
Using `--reply=yes' makes `cp' act as if `yes' were given as a
response to every prompt about a destination file. That
effectively cancels any preceding `--interactive' or `-i' option.
Specify `--reply=no' to make `cp' act as if `no' were given as a
response to every prompt about a destination file. Specify
`--reply=query' to make `cp' prompt the user about each existing
destination file.


What you would do (I think) is do cp -i --reply=no

That way, it will ask if you want to overwrite the file and automatically say "no." Check your version and give it a test run as this option will be removed very soon!"

Another solution is to use
rysnc --ingore-existing
'via Blog this'

2 comments:

  1. In this condition I used DuplicateFilesDeleter effectively. This software will let you get a huge amount of space for your use by deleting the files that were at multiple locations.

    ReplyDelete
    Replies
    1. Thanks Danewan for sharing the tips. I would try it later.

      Delete