Results 1 to 4 of 4

Thread: cli: directory mirror

Hybrid View

  1. #1
    Join Date
    Oct 2007
    Beans
    23

    cli: directory mirror

    Hi all. I need to maintain a mirror copy (b) of a directory structure (a). The following must take place (assuming the dir structures don't change):


    - copy all new files from a to b (/a/1/01/file --> /b/1/01/file
    - overwrite copy all changed files a to b
    - delete from b files removed from a
    - do this for all files in all subdirectories, but ignore (skip) for directories starting with "xyz"

    any cli guru's out there willing to share some wisdom?

  2. #2
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: cli: directory mirror

    have a look at rsync

  3. #3
    Join Date
    Mar 2008
    Location
    England
    Beans
    Hidden!
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: cli: directory mirror

    Quote Originally Posted by r0b0h0b0 View Post
    Hi all. I need to maintain a mirror copy (b) of a directory structure (a). The following must take place (assuming the dir structures don't change):


    - copy all new files from a to b (/a/1/01/file --> /b/1/01/file
    - overwrite copy all changed files a to b
    - delete from b files removed from a
    - do this for all files in all subdirectories, but ignore (skip) for directories starting with "xyz"

    any cli guru's out there willing to share some wisdom?
    Code:
    rsync -av /home/user/a --delete --exclude 'xyz*' /home/user/b

  4. #4
    Join Date
    Oct 2007
    Beans
    23

    Re: cli: directory mirror

    Yup, that's the one. In fact, man rsync tells me it's quite versatile.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •