Sponsored Content
Top Forums Shell Programming and Scripting Compare files in directories with md5sum Post 302888036 by Jomeaide on Wednesday 12th of February 2014 10:46:09 AM
Old 02-12-2014
RedHat Compare files in directories with md5sum

And not to start. I can compare files, that's easy. The problem is that I compare files in a directory, and check if these files exist in another directory. The problem is that the file names are not the same. So I have to compare with "md5sum" or something similar. How I can do?

All this in python.

Thanks! Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare files from two directories

HI, i want to compare one file from one directory to many files in other directory. means in my /DIR/20070930/b/STG* directory i have only one file and in /DIR/20070930/a/STG* directory i have many files. so i want to check the name of that files should be present in other directory or not ... (2 Replies)
Discussion started by: ravi214u
2 Replies

2. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

3. UNIX for Dummies Questions & Answers

compare all files under directories

Hello I am very new to Unix. I am actually using the C shell to write a program that will compare all the files in the directory and subdirectores and print out the ones that are identical, I am assuming identical by name or text Thank you (2 Replies)
Discussion started by: ga.miami56
2 Replies

4. UNIX for Dummies Questions & Answers

How to compare files in 2 directories?

Hi, I want to compare the content of 2 directories and list down both the duplicate and unique files from each directory. Tried to use diff but but not able to achieve the result. For example, DirA FileX FileY FileZ DirB FileY The desired outcome is Duplication: FileY... (1 Reply)
Discussion started by: Andre_2008
1 Replies

5. Shell Programming and Scripting

how to compare two files in different directories

Hi all , Can any one give me the solution for below query. I have two files . firstfile: xyz123 abc234 text2456 secondfile (\home\test) xyz123:ram ab34:scrit text2456:maven After you compare the ouput should the the common items in both files (2 Replies)
Discussion started by: sravan008
2 Replies

6. UNIX for Dummies Questions & Answers

Compare files in two directories

Hi All, I have two directories that has some files, some of the files are common to both of them like : ls -l dir1 file1 file2 file3 ls -l dir2 file1 file2 file3 file4 file5 Now i want to get the files from dir2 that are not present in dir1 (means i want to get... (2 Replies)
Discussion started by: mukulverma2408
2 Replies

7. Shell Programming and Scripting

Compare files of 2 directories

Hi all, I have 2 directories dir1 and dir2 which contains many xml files. I need to compare files of dir1 with that of dir2 and if they match, I need to cut it from dir1 and paste it in dir2. I need to do this thru scripts. I'm currently investigating on the diff command. Please help me write... (6 Replies)
Discussion started by: frum
6 Replies

8. Shell Programming and Scripting

Compare md5sum two servers' setup

I'm trying to think of a way to compare two boxes and make sure their files will be the same. There may be extra files on one side and some on the other. I also need to make sure the file content is identical. So far I've gotten this to create a file find /directorypath/ -type f -name... (3 Replies)
Discussion started by: xgringo
3 Replies

9. UNIX for Beginners Questions & Answers

Expect in Bash - and then compare md5sum

I'm running on a staging server. I will need to use expect and I think ssh or scp to the other boxes. I need to see something like this....Enter:Host 1 Enter:Host 2 Enter full directory path to compare: example /apps/acd/jboss-customer1/ Enter User Id: Enter Password: ( Assumes... (6 Replies)
Discussion started by: xgringo
6 Replies

10. Shell Programming and Scripting

Compare two md5sum

Hello, First of all I want to apologize because i'm not a admin or coder and maybe all my efforts to write only this small script in my life would need one week full time reading man pages and forums but... I don't have the money to offer me to get this time and the script I want to do seems... (5 Replies)
Discussion started by: toscan
5 Replies
DEBDIFF(1)						      General Commands Manual							DEBDIFF(1)

NAME
       debdiff - compare file lists in two Debian packages

SYNOPSIS
       debdiff [options]
       debdiff [options] ... deb1 deb2
       debdiff [options] ... changes1 changes2
       debdiff [options] ... --from deb1a deb1b ...  --to deb2a deb2b ...
       debdiff [options] ... dsc1 dsc2

DESCRIPTION
       debdiff takes the names of two Debian package files (.debs or .udebs) on the command line and compares their contents (considering only the
       files in the main package, not the maintenance scripts).  It shows which files have been introduced and which removed between the two pack-
       age  files,  and  is  therefore useful for spotting files which may have been inadvertently lost between revisions of the package.  It also
       checks the file owners and permissions, and compares the control files of the two packages using the wdiff program.

       If no arguments are given, debdiff tries to compare the content of the current source directory with the last version of the package.

       debdiff can also handle changes between groups of .deb files in two ways.  The first is to specify two .changes files.  In this	case,  the
       .deb  files listed in the .changes file will be compared, by taking the contents of all of the listed .deb files together.  (The .deb files
       listed are assumed to be in the same directory as the .changes file.)  The second way is to list the .deb files	of  interest  specifically
       using the --from ... --to syntax.  These both help if a package is broken up into smaller packages and one wishes to ensure that nothing is
       lost in the interim.

       debdiff examines the devscripts configuration files as described below.	Command line options override  the  configuration  file  settings,
       though.

       If  debdiff  is passed two source packages (.dsc files) it will compare the contents of the source packages.  If the source packages differ
       only in Debian revision number (that is, the .orig.tar.gz files are the same in the two .dsc files), then interdiff(1) will be used to com-
       pare the two patch files if this program is available on the system, otherwise a diff will be performed between the two source trees.

OPTIONS
       --dirs, -d
	      The  default mode of operation is to ignore directory names which appear in the file list, but they, too, will be considered if this
	      option is given.

       --nodirs
	      Ignore directory names which appear in the file list.  This is the default and it can be used to override a configuration file  set-
	      ting.

       --move FROM TO, -m FROM TO
	      It  sometimes  occurs  that various files or directories are moved around between revisions.  This can be handled using this option.
	      There are two arguments, the first giving the location of the directory or file in the first package, and the second in the  second.
	      Any files in the first listing whose names begin with the first argument are treated as having that substituted for the second argu-
	      ment when the file lists are compared.  Any number of --move arguments may be given; they are processed in the order in  which  they
	      appear.

       --move-regex FROM TO
	      This  is	the  same  as --move, except that FROM is treated as a regular expression and the perl substitution command s/^FROM/TO/ is
	      applied to the files.  In particular, TO can make use of backreferences such as $1.

       --nocontrol
	      debdiff will usually compare the respective control files of the packages using wdiff(1).  This option suppresses this part  of  the
	      processing.

       --control
	      Compare the respective control files; this is the default, and it can be used to override a configuration file setting.

       --controlfiles FILE[,FILE ...]
	      Specify  which  control files to compare; by default this is just control, but could include postinst, config and so on.	Files will
	      only be compared if they are present in both .debs being compared.  The special value ALL compares all control files present in both
	      packages, except for md5sums.  This option can be used to override a configuration file setting.

       --wdiff-source-control
	      When processing source packages, compare control files using wdiff.  Equivalent to the --control option for binary packages.

       --no-wdiff-source-control
	      Do not compare control files in source packages using wdfiff.  This is the default.

       --wp, --wl, --wt
	      Pass a -p, -l or -t option to wdiff respectively.  (This yields the whole wdiff output rather than just the lines with any changes.)

       --show-moved
	      If  multiple  .deb  files are specified on the command line, either using .changes files or the --from/--to syntax, then this option
	      will also show which files (if any) have moved between packages.	(The package names are simply determined from  the  names  of  the
	      .deb files.)

       --noshow-moved
	      The default behaviour; can be used to override a configuration file setting.

       --renamed FROM TO
	      If  --show-moved is being used and a package has been renamed in the process, this command instructs debdiff to treat the package in
	      the first list called FROM as if it were called TO.  Multiple uses of this option are permitted.

       --exclude PATTERN
	      Exclude files that match PATTERN.  Multiple uses of this option are permitted.

       --diffstat
	      Include the result of diffstat before the generated diff.

       --no-diffstat
	      The default behaviour; can be used to override a configuration file setting.

       --auto-ver-sort
	      When comparing source packages, do so in version order.

       --no-auto-ver-sort
	      Compare source packages in the order they were passed on the command-line, even if that means comparing a package with a higher ver-
	      sion against one with a lower version.  This is the default behaviour.

       --unpack-tarballs
	      When  comparing  source  packages, also unpack tarballs found in the top level source directory to compare their contents along with
	      the other files.	This is the default behaviour.

       --no-unpack-tarballs
	      Do not unpack tarballs inside source packages.

       --no-conf, --noconf
	      Do not read any configuration files.  This can only be used as the first option given on the command-line.

       --help, -h
	      Show a summary of options.

       --version, -v
	      Show version and copyright information.

       --quiet, -q
	      Be quiet if no differences were found.

       --ignore-space, -w
	      Ignore whitespace in diffs.

CONFIGURATION VARIABLES
       The two configuration files /etc/devscripts.conf and ~/.devscripts are sourced by a shell in that order	to  set  configuration	variables.
       Command line options can be used to override configuration file settings.  Environment variable settings are ignored for this purpose.  The
       currently recognised variables are:

       DEBDIFF_DIRS
	      If this is set to yes, then it is the same as the --dirs command line parameter being used.

       DEBDIFF_CONTROL
	      If this is set to no, then it is the same as the --nocontrol command line parameter being used.  The default is yes.

       DEBDIFF_CONTROLFILES
	      Which control files to compare, corresponding to the --controlfiles command line option.	The default is control.

       DEBDIFF_SHOW_MOVED
	      If this is set to yes, then it is the same as the --show-moved command line parameter being used.

       DEBDIFF_WDIFF_OPT
	      This option will be passed to wdiff; it should be one of -p, -l or -t.

       DEBDIFF_SHOW_DIFFSTAT
	      If this is set to yes, then it is the same as the --diffstat command line parameter being used.

       DEBDIFF_WDIFF_SOURCE_CONTROL
	      If this is set to yes, then it is the same as the --wdiff-source-control command line parameter being used.

       DEBDIFF_AUTO_VER_SORT
	      If this is set to yes, then it is the same as the --auto-ver-sort command line parameter being used.

       DEBDIFF_UNPACK_TARBALLS
	      If this is set to no, then it is the same as the --no-unpack-tarballs command line parameter being used.

EXIT VALUES
       Normally the exit value will be 0 if no differences are reported and 1 if any are reported.  If there is some fatal error,  the	exit  code
       will be 255.

SEE ALSO
       dpkg-deb(1), wdiff(1), interdiff(1), diffstat(1) and devscripts.conf(5).

AUTHOR
       debdiff was originally written as a shell script by Yann Dirson <dirson@debian.org> and rewritten in Perl with many more features by Julian
       Gilbey <jdg@debian.org>.  The software may be freely redistributed under the terms and conditions of the GNU General Public  License,  ver-
       sion 2.

DEBIAN								 Debian Utilities							DEBDIFF(1)
All times are GMT -4. The time now is 07:59 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy