Compare two directory and find differents


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Compare two directory and find differents
# 8  
Old 04-14-2020
Good find, but: it will run 9 external commands and thus use approx. the fivefold time, and, as is, it won't confine itself on .doc[x]? and .pdf files.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to find and get a file in an entire directory with an excluded directory specified?

How to get a file 'zlib.h' in an entire directory with an excluded directory specified lives under that starting directory by using find command, as it failed on: $ find . -name 'zlib.h' -a -ipath 'CHROME.TMP' -prune -o -print it'll just list entirely up (2 Replies)
Discussion started by: abdulbadii
2 Replies

2. Shell Programming and Scripting

Compare directory dates

hi, I need to know if a specific directory exists in a folder named after the date of yesterday (02/06/2015) The problem is simple but not how to do it. :confused:i= date -d "yesterday" '%Y-%m-%d' <- the format of directory is 2015-06-02 if in /var/logroot/index exist directory whit... (4 Replies)
Discussion started by: tmeto
4 Replies

3. Shell Programming and Scripting

awk - matching on 2 columns for differents lines

Given this file (I separated them in block to make my explanation clearer): 92157768877;Sof_deme_Fort_Email_am_%yyyy%%mm%%dd%;EMAIL;20/02/2015;1;0;0 92157768877;Sof_trav_Fort_Email_am_%yyyy%%mm%%dd%;EMAIL;20/02/2015;1;0;0 91231838895;Sof_deme_faible_Email_am;EMAIL;26/01/2015;1 0;0... (1 Reply)
Discussion started by: Andy_K
1 Replies

4. Programming

Query SQL get two values differents from the same columns

Hi, I have 2 different values in the same column and two different values in other column Query 1 ins name value 1 Test 12345 1 TestV1 12/10/2014 8 Test 85435 8 TestV1 11/11/2005 9 Test 42232 9 TestV1 19/10/2000 6 Test 54321... (6 Replies)
Discussion started by: faka
6 Replies

5. Shell Programming and Scripting

Find every directory named XYZ under the DVLP directory

I only want to find files under each branch of the directory tree inside directories named XYZ and there are multiple XYZ directories? (7 Replies)
Discussion started by: emc^24sho
7 Replies

6. Shell Programming and Scripting

Extract sequences of bytes from binary for differents blocks

Hello to all, I would like to search sequences of bytes inside big binary file. The bin file contains blocks of information, each block begins is estructured as follow: 1- Each block begins with the hex 32 (1 byte) and ends with FF. After the FF of the last block, it follows 33. 2- Next... (59 Replies)
Discussion started by: Ophiuchus
59 Replies

7. Shell Programming and Scripting

Compare new version of two directory

How to compare new version exist of two path directory. for e.g., path1 - /user/path/test/ path2 - /user/path/score/ If its exist new version then copy that new version into the first path directroy. How will do this. (3 Replies)
Discussion started by: roy1912
3 Replies

8. Shell Programming and Scripting

How i can obtain differents data on a single pass?

#!/bin/bash for i in `ls -c1 /usr/share/applications` do #name=`cat /usr/share/applications/$i | grep ^Name= | cut -d = -f2` #categories=`cat /usr/share/applications/$i | grep ^Categories= | sed 's/;/=/g' | cut -d = -f2` name=$(grep ^Name= /usr/share/applications/$i | cut -d = -f2)... (12 Replies)
Discussion started by: alexscript
12 Replies

9. Shell Programming and Scripting

Script That Can navigate to 3 differents directory & remove files under them

Hi I am Trying to Write a script that can goto 4 different directorys on the server & remove the Files older then 30 days ?? /logs logs1 logs2 logs3 Now I need to remove files under logs1 logs2 logs3 which are older then 30 days whose name stat 'sit' , 'mig','bld' . in... (3 Replies)
Discussion started by: Beginner123
3 Replies

10. Shell Programming and Scripting

Directory compare script

Hello, I am looking for a script, or pointer to an approach to creating a script, that will compare two versions of a codebase and output a third directory structure containing only the files that differ between the two. I use diff quite often, but it will only create patch files (AFAIK). Does... (3 Replies)
Discussion started by: jwilliams108
3 Replies
Login or Register to Ask a Question
DirCompare(3pm) 					User Contributed Perl Documentation					   DirCompare(3pm)

NAME
File::DirCompare - Perl module to compare two directories using callbacks. SYNOPSIS
use File::DirCompare; # Simple diff -r --brief replacement use File::Basename; File::DirCompare->compare($dir1, $dir2, sub { my ($a, $b) = @_; if (! $b) { printf "Only in %s: %s ", dirname($a), basename($a); } elsif (! $a) { printf "Only in %s: %s ", dirname($b), basename($b); } else { print "Files $a and $b differ "; } }); # Version-control like Deleted/Added/Modified listing my (@listing, @modified); # use closure to collect results File::DirCompare->compare('old_tree', 'new_tree', sub { my ($a, $b) = @_; if (! $b) { push @listing, "D $a"; } elsif (! $a) { push @listing, "A $b"; } else { if (-f $a && -f $b) { push @listing, "M $b"; push @modified, $b; } else { # One file, one directory - treat as delete + add push @listing, "D $a"; push @listing, "A $b"; } } }); DESCRIPTION
File::DirCompare is a perl module to compare two directories using a callback, invoked for all files that are 'different' between the two directories, and for any files that exist only in one or other directory ('unique' files). File::DirCompare has a single public compare() method, with the following signature: File::DirCompare->compare($dir1, $dir2, $sub, $opts); The first three arguments are required - $dir1 and $dir2 are paths to the two directories to be compared, and $sub is the subroutine reference called for all unique or different files. $opts is an optional hashref of options - see OPTIONS below. The provided subroutine is called for all unique files, and for every pair of 'different' files encountered, with the following signature: $sub->($file1, $file2) where $file1 and $file2 are the paths to the two files. For 'unique' files i.e. where a file exists in only one directory, the subroutine is called with the other argument 'undef' i.e. for: $sub->($file1, undef) $sub->(undef, $file2) the first indicates $file1 exists only in the first directory given ($dir1), and the second indicates $file2 exists only in the second directory given ($dir2). OPTIONS The following optional arguments are supported, passed in using a hash reference after the three required arguments to compare() e.g. File::DirCompare->compare($dir1, $dir2, $sub, { cmp => $cmp_sub, ignore_unique => 1, }); cmp By default, two files are regarded as different if their contents do not match (tested with File::Compare::compare). That default behaviour can be overridden by providing a 'cmp' subroutine to do the file comparison, returning zero if the two files are equal, and non-zero if not. E.g. to compare using modification times instead of file contents: File::DirCompare->compare($dir1, $dir2, $sub, { cmp => sub { -M $_[0] <=> -M $_[1] }, }); ignore_cmp If you want to see all corresponding files, not just 'different' ones, set the 'ignore_cmp' flag to tell File::DirCompare to skip its file comparison checks i.e. File::DirCompare->compare($dir1, $dir2, $sub, { ignore_cmp => 1 }); ignore_unique If you want to ignore files that only exist in one of the two directories, set the 'ignore_unique' flag i.e. File::DirCompare->compare($dir1, $dir2, $sub, { ignore_unique => 1 }); SEE ALSO
File::Dircmp, which provides similar functionality (and whose directory walking code I've adapted for this module), but a simpler reporting-only interface, something like the first example in the SYNOPSIS above. AUTHOR AND CREDITS
Gavin Carr <gavin@openfusion.com.au> Thanks to Robin Barker for a bug report and fix for glob problems with whitespace. COPYRIGHT AND LICENSE
Copyright 2006-2007 by Gavin Carr. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-03-02 DirCompare(3pm)