Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Copy only modified files and new folder

  • 04-05-2009 10:03AM
    #1
    Registered Users, Registered Users 2 Posts: 3,312 ✭✭✭


    Can anyone tell me how to copy one directory structure to another (Same layout and same name). All I want to do is to copy new or modified files and directories. If the dir exists then only update the files that have changed. Hope that makes sense?


Comments

  • Closed Accounts Posts: 12,807 ✭✭✭✭Orion


    rsync -update source destination


  • Registered Users, Registered Users 2 Posts: 1,183 ✭✭✭dioltas


    You could use unison (I think that's what it's called).


  • Registered Users, Registered Users 2 Posts: 279 ✭✭velocirafter


    rsync -av --delete <source> <backup>

    will copy only the updated files over and delete files in the destination that do not exist anymore in the source


  • Registered Users, Registered Users 2 Posts: 1,606 ✭✭✭djmarkus


    rsync -av --delete <source> <backup>

    will copy only the updated files over and delete files in the destination that do not exist anymore in the source


    man cp:

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


  • Registered Users, Registered Users 2 Posts: 3,312 ✭✭✭irishguy


    Ill try them all thanks for the help


  • Advertisement
Advertisement