LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices


Reply
  Search this Thread
Old 10-21-2009, 03:58 PM   #1
prasenjit.patra
LQ Newbie
 
Registered: Sep 2009
Posts: 2

Rep: Reputation: 0
How to compare timestamp of same file residing in two diff directories


Hi,

I have a requirement like following:

I have two dir: DIR1 and DIR2. Files of DIR1 are updated on a regular basis based on requirement. Then updated files are copied to DIR2. So I need to write a shell script which will tell us whether all the files in DIR2 are the updated files or not. This is to make sure that all required files were copied properly from DIR1 to DIR2.

Can anyone please help me how I'll compare the timestamp of a file between the 2 directories.

/home/user/DIR1]ls -l
-rwxrwxr-x 1 user group 509 Jan 08 2009 file_1.dat
-rwxrwxr-x 1 user group 11 Sep 29 12:19 file_2.dat

/home/user/DIR2]ls -l
-rwxrwxr-x 1 user group 509 Jan 08 2008 file_1.dat
-rwxrwxr-x 1 user group 40 Oct 21 12:19 file_2.dat

Thanks & Regards,
Prasenjit
 
Old 10-21-2009, 04:45 PM   #2
harry edwards
Member
 
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
I beleive rsync will tell you what you want.

This command will synchronise the directories:
rsync -av dir1/ dir2/

This command will show the differences e.g. what will be synchronised:
rsync -av --dry-run dir1/ dir2/
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to compare two directories residing in two different servers prasenjit.patra AIX 2 09-28-2009 09:20 PM
Recursive diff ( File compare ) script sharathkv25 Programming 5 02-22-2007 08:39 AM
mass file compare or diff mijohnst Linux - Software 11 01-27-2006 06:32 AM
Timestamp of file/directories Ephracis Linux - Software 1 12-16-2004 09:21 AM
Using diff to compare file with common lines, but at different line numbers jimieee Linux - Newbie 3 05-10-2004 07:26 AM

LinuxQuestions.org > Forums > Other *NIX Forums > AIX

All times are GMT -5. The time now is 02:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration