![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need some help..Comparison | bluesilo | Shell Programming and Scripting | 0 | 02-23-2008 04:43 PM |
| Timestamp comparison | zainravi | Shell Programming and Scripting | 1 | 01-21-2008 08:28 AM |
| Unix comparison | NewGuy100 | UNIX for Dummies Questions & Answers | 1 | 12-14-2005 04:42 PM |
| comparison problem | ranj@chn | Shell Programming and Scripting | 8 | 11-05-2005 07:03 AM |
| comparison | cnf | Filesystems, Disks and Memory | 2 | 05-14-2002 01:52 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
||||
|
dir comparison help
How do I find a duplicate files in two directories:
scenerio: dirA: file1 file2 file3 dirB: file1 file4 file5 file6 file1 is residing at both locations while should be only at dirA. ll /test/dirA | cut -c 59-80 > /test/dirA/files_at_dira ll /test/dirB | cut -c 59-80 > /test/dirB/files_at_dirb for file in /test/dirA/files_at_dira do grep $file /test/dirB/files_at_dirb if $? = 0 then echo "duplicate file $file found at /test/dirB/" rm -i $file /test/dirB/ else "duplicate file not found" fi done Can some one please help on this. Thank you in advance. Ghazi |
|
||||
|
Thanks for your reply but I wanted to set up some kind of
automated script via cron which makes the two dir in sync on regular basis. dircmp displays dirA and dirB in tabulated form. I tried with both -d option but does not help. |
|
|||||
|
I modified yr script ...
Pass params on the command line ... and modify the script depend on yr case ... |
|
||||
|
I have done some change and it is working for me. I going to modify it further to meet my needs.
LOG=/test/temp/DUP_CHECK.`date '+%Y%m%d%H%M%S'` file_1=$1 file_2=$2 for file1 in `cat $1` do grep $file1 $2 if test $? -eq 0 then echo "duplicate file $file1 found at $2 " >> $LOG 2>&1 else echo "duplicate file not found" >> $LOG 2>&1 fi done Thanks for your help. Ghazi I appreciate your help. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|