Find the answer to your Linux question:
Results 1 to 6 of 6
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    howto sync two directories

    How can i sync two directories (the files in the primary directory might be in use)

    i have a directory name DIR-1 on computer-1 and a second directory DIR-2 of computer-2 mounted on the computer-1 which is mounted on computer-1 as /mount/DIR-2

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    man rsync

    If you mounted the directories just for syncing, then you dont have to do that.
    Rsync works over the network

    Quick and dirty:
    On computer-1
    rsync -av -e ssh /DIR-1/* USER@computer-2:/DIR-2/

    This requires:
    - Your current user on computer-1 has access to DIR-1
    - USER on computer-2 has access to DIR-2
    - ssh is set up
    - rsync is installed on both

    - the -v (verbose) option might or might not be desireable. It will print each file transmitted
    - using ssh is a quick and dirty way, but "raw" rsync -ie with an configured rsyncd- is faster, as there is no encryption
    - within rsyncd.conf you can also define users/passwords, etc
    - Be carefull, what you rsync and where. Especially with --delete

  3. #3
    Thanks i did it
    is it possible that i can run the rsync command after 5 minutes

  4. $spacer_open
  5. #4
    Linux Guru bigtomrodney's Avatar
    Join Date
    Nov 2004
    You can use cron to schedule the command. Make sure you are happy that it's workin as you wish, then use crontab -e to edit your cron.

    Cron can be quite complicated, it'd be best to read up on it first. Cron.

    .---------------- minute (0 - 59) 
    |  .------------- hour (0 - 23)
    |  |  .---------- day of month (1 - 31)
    |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... 
    |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7)  OR sun,mon,tue,wed,thu,fri,sat 
    |  |  |  |  |
    *  *  *  *  *  command to be executed
    An example for every five minutes might be
    */5 * * * * rsync -av -e ssh /DIR-1/* user@computer-2:/DIR-2/

  6. #5
    Thanks for your help. i have done this successfully
    thanks again

  7. #6
    You can try to use iFolder. Just search in google.
    iFolder is a simple and secure storage solution that can increase your productivity by enabling you to back up, access and manage your personal files-from anywhere, at any time. Once you have installed iFolder, you simply save your files locally-as you have always done-and iFolder automatically updates the files on a network server and delivers them to the other machines you use.

Posting Permissions

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