Technology Tales

Adventures & experiences in contemporary technology

Copying only updated and new files

20th October 2008

With Linux/UNIX, the command line remains ever useful and allows you to do all manner of things, including file copying that only adds new files to a destination. Here’s a command that accomplishes this in Linux:

cp -urv [source] [destination]

The u switch does the update while r ensures recursion (by default, cp only copies files from a source directory and not anything sitting in subfolders) and v tells the command to tell the user what is happening.

Though buried and hardly promoted, Windows also has its command line and here’s what accomplishes a similar result:

xcopy /d /u [source] [destination]

Anything’s better than having to approve or reject every instance where source and destination files are the same or, even worse, to overwrite a file when it is not wanted.

  • All the views that you find expressed on here in postings and articles are mine alone and not those of any organisation with which I have any association, through work or otherwise. As regards editorial policy, whatever appears here is entirely of my own choice and not that of any other person or organisation.

  • Please note that everything you find here is copyrighted material. The content may be available to read without charge and without advertising but it is not to be reproduced without attribution. As it happens, a number of the images are sourced from stock libraries like iStockPhoto so they certainly are not for abstraction.

  • With regards to any comments left on the site, I expect them to be civil in tone of voice and reserve the right to reject any that are either inappropriate or irrelevant. Comment review is subject to automated processing as well as manual inspection but whatever is said is the sole responsibility of the individual contributor.