Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SYNC between Two directories

Posted on 2008-10-25
11
Medium Priority
?
1,284 Views
Last Modified: 2012-06-22
I want to sync files and directores between two directories  even sub directories under   below that directories wtih shell scripts.

example
/mnt/test1
/mnt/test2

both test2 must sync with test1 with shell script and i wat to schdule shell script under cron job every mid night


0
Comment
Question by:vadicherla
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 
LVL 9

Expert Comment

by:chingmd
ID: 22806303
You will want to look at the command rsync.  

0
 
LVL 9

Accepted Solution

by:
chingmd earned 1000 total points
ID: 22806304
without testing.   this is something of what it'll look like.

rsync avr --delete /mnt/source /mnt/destination
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 1000 total points
ID: 22806325
You don't need a script, just define a cronjob as

0 0 * * * rsync -a --delete /mnt/test1 /mnt/test2
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 22807863
Hi,
if you don't have rsync installed, you can obtain it hetr
http://rsync.samba.org/
wmp
0
 

Author Comment

by:vadicherla
ID: 22807958
Does rsync also verify the time stamp on file. If we have same file on both directories . i still need to copy the file from A to B because it modified

Thanks
Sudhakar
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 22807999
Thats one of the most important features of rsync
0
 
LVL 9

Expert Comment

by:chingmd
ID: 22817493
As well as you can set it to check checksums on the file.  So if for some reason you are not keeping Atime and Mtime on the filesystem rsync will still keep the files in sync.
0
 
LVL 9

Expert Comment

by:chingmd
ID: 22817499
Oh yeah!  it's also a great tool for remotely keeping files in sync..   so you have have an off machine backup.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question