Sponsored Content
Top Forums Shell Programming and Scripting Compare the checksum of files in 2 different folders Post 302381592 by durden_tyler on Friday 18th of December 2009 10:58:42 PM
Old 12-18-2009
Quote:
Originally Posted by reldb
...
I was doing as below -

cd folder1
find . -type f | sort | cksum >1.txt

cd folder2
find . -type f | sort | cksum >2.txt

1) diff -w 1.txt 2.txt

still it shows lot of lines in diff even when file name/path/size/checksum is same. ...
You may want to list, sort and find cksum of each file as shown in the following example:

Code:
$ # go to directory dir1
$ cd dir1
$
$ ls | sort | xargs cksum
1958180199 14 file1
1994293486 14 file2
1996893289 14 file3
$
$ # now do the same for directory dir2
$ cd ../dir2
$
$ ls | sort | xargs cksum
1958180199 14 file1
1994293486 14 file2
1996893289 14 file3
$
$

And as you are doing currently, redirect the output to two files and find the diff.

tyler_durden
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remote compare of folders

Hi, Is there a way (either commands/tools/scripts/logic) to compare two given folders on different unix boxes. I want to compare folder a in Unix box 'A' with folder 'b' in Unix box 'B'. I can run the script in Unix box 'A'. I am looking. for following results: files/sub folders only in a... (1 Reply)
Discussion started by: sunilav
1 Replies

2. Shell Programming and Scripting

Compare 2 folders...

Hello, I try to compare 2 folders, i explain, i have file in this 2 folder and i want to print out the difference in this folders... ex: folder1: file1 file2 file3 folder2: file1 file2 print file3 I do a ls of the 2 folders and i use the command diff (diff $var1 $var2) without... (8 Replies)
Discussion started by: protocomm
8 Replies

3. Shell Programming and Scripting

Compare files in two folders and delete missing ones

I do not know much about shell scripting so I am at a loss here. If someone can help me, that would be great! I have two directories /dir1 /dir2 I need to delete all files from /dir1 and that does not have a correspondent file in /dir2. It should NOT check file suffixes in /dir2 . Why?... (20 Replies)
Discussion started by: kaah
20 Replies

4. Shell Programming and Scripting

Compare 2 folders to find several missing files among huge amounts of files.

Hi, all: I've got two folders, say, "folder1" and "folder2". Under each, there are thousands of files. It's quite obvious that there are some files missing in each. I just would like to find them. I believe this can be done by "diff" command. However, if I change the above question a... (1 Reply)
Discussion started by: jiapei100
1 Replies

5. Shell Programming and Scripting

How to compare files in two folders using cmp?

i recently copied 400GB of data from a NTFS drive to a ext4 drive. I want to verify that the data is 100% identical to the original. I wanted to use cmp but it only does two files. The directory that was copied contains many subdirectories and all sorts of files (not just text). So I guess... (5 Replies)
Discussion started by: fuzzylogic25
5 Replies

6. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

7. IP Networking

Wireshark UDP checksum bad checksum

Hello I am communicating with two devices using my computer over UDP protocol. The application is running fine. When I monitored the UDP traffic using Wireshark software, I found that there were too many Checksum errors. Please find attached the png file showing this error. I am about to... (0 Replies)
Discussion started by: AustinCann
0 Replies

8. Shell Programming and Scripting

Linux Script to compare two folders and copy missing files

Hi, I need help in shell scripting. If someone can help me, that would be great! Problem. I want Linux Script to compare two folders and copy missing files. Description. I have two directories /dir1 /dir2 I need to copy all distinct/new/unique/missing files from /dir1 and that... (1 Reply)
Discussion started by: S.Praveen Kumar
1 Replies

9. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies

10. Shell Programming and Scripting

Script to compare files in 2 folders and delete the large file

Hello, my first thread here. I've been searching and fiddling around for about a week and I cannot find a solution.:confused: I have been converting all of my home videos to HEVC and sometimes the files end up smaller and sometimes they don't. I am currently comparing all the video files... (5 Replies)
Discussion started by: Josh52180
5 Replies
folders(1)						      General Commands Manual							folders(1)

NAME
folders - list folders and contents (only available within the message handling system, mh) SYNOPSIS
folders [+folder] [msg] [options] OPTIONS
Lists only the name of folders, with no additional information. This is faster because the folders need not be read. Prints a list of the valid options to this command. Lists the contents of the folder-stack. No +folder argument is allowed with this option. Re-numbers mes- sages in the folders. Messages are re-numbered sequentially, and any gaps in the numbering are removed. The default operation is -nopack, which does not change the numbering in the folder. Discards the top of the folder-stack, after setting the current folder to that value. No +folder argument is allowed with this option. This corresponds to the popd operation in the C-shell; see csh(1). The -push and -pop options are mutually exclusive: the last occurrence of either one overrides any previous occurrence of the other. Pushes the current folder onto the folder-stack, and makes the +folder argument into the current folder. If +folder is not given, the current folder and the top of the folder-stack are exchanged. This corresponds to the pushd operation in the C-shell; see csh(1). The -push switch and the -pop switch are mutually exclusive: the last occurrence of either one overrides any previous occurrence of the other. Lists folders recur- sively. Information on each folder is displayed, followed by information on any sub-folders which it contains. Displays only the total number of messages and folders in your Mail directory. This option does not print any information about individual folders. It can be sup- pressed using the -nototal option. The defaults for folders are: +folder defaults to all msg defaults to none -nofast -noheader -nototal -nopack -norecurse DESCRIPTION
The folders command displays the names of your folders and the number of messages that they each contain. The folders command displays a list of all the folders in your Mail directory. The folders are sorted alphabetically, each on its own line. This is illustrated in the following example: Folder # of messages ( range ); cur msg (other files) V2.3 has 3 messages ( 1- 3). adrian has 20 messages ( 1- 20); cur= 2. brian has 16 messages ( 1- 16). chris has 12 messages ( 1- 12). copylog has 242 messages ( 1- 242); cur= 225. inbox+ has 73 messages ( 1- 127); cur= 127. int has 4 messages ( 1- 4); cur= 2 (others). jack has 17 messages ( 1- 17); cur= 17. TOTAL= 387 messages in 8 folders. The plus sign (+) after inbox indicates that it is the current folder. The information about the int folder includes the term (others). This indicates that the folder int contains files which are not messages. These files may be either sub-folders, or files that do not belong under the MH file naming scheme. The folders command is identical to the effect of using the -all option to the folder command. If you use folders with the +folder argument, it will display all the subfolders within the named folder. as shown in the following exam- ple: % folders +test Folder # of messages ( range ); cur msg (other files) test+ has 18 messages ( 1- 18); (others). test/testone has 1 message ( 1- 1). test/testtwo has no messages. TOTAL= 19 messages in 3 folders. See refile(1) for more details of sub-folders. RESTRICTIONS
MH does not allow you to have more than 100 folders at any level in your Mail directory. PROFILE COMPONENTS
Path: To determine your MH directory Folder-Protect: To set protections when creating a new folder Folder-Stack: To determine the folder stack lsproc: Program to list the contents of a folder FILES
The user profile. SEE ALSO
csh(1), folder(1), refile(1), mhpath(1) folders(1)
All times are GMT -4. The time now is 11:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy