09-22-2010
Alistair, i wanted to use diff command because it can do things recursively, but isnt that only for text files? I mean it says it does a line by line comparison, where cmp does byte by byte. I am dealing with alot of non-text files as well.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am comparing two files which are identical except for the timestamp which is incorporated within the otherwise same 372 bytes. I am using the command:
cmp -s $Todays_file $Yesterdays_file -i 372
When I run the command without the -i 372 it shows the difference i.e. the timestamp.... (5 Replies)
Discussion started by: gugs
5 Replies
2. Shell Programming and Scripting
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
Hi All,
I have to compare set of files so I created a case statement with the option to give more than one file to compare. The Problem now i am facing is, if I compare the files directly, from prompt or just using the script only for a particular file then It's saying No difference, but If I... (4 Replies)
Discussion started by: Sudhar
4 Replies
4. Shell Programming and Scripting
Hi
I have 2 different folders on different machines. they are supposed to be same but some time for unknown reason they are not. then we have to generate a report for files which are not matching.
I was doing as below -
cd folder1
find . -type f | sort | cksum >1.txt
cd folder2
find .... (7 Replies)
Discussion started by: reldb
7 Replies
5. Shell Programming and Scripting
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
6. Shell Programming and Scripting
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
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
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
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
CMP(1) BSD General Commands Manual CMP(1)
NAME
cmp -- compare two files
SYNOPSIS
cmp [-l | -s] file1 file2 [skip1 [skip2]]
DESCRIPTION
The cmp utility compares two files of any type and writes the results to the standard output. By default, cmp is silent if the files are the
same; if they differ, the byte and line number at which the first difference occurred is reported.
Bytes and lines are numbered beginning with one.
The following options are available:
-l Print the byte number (decimal) and the differing byte values (octal) for each difference.
-s Print nothing for differing files; return exit status only.
The optional arguments skip1 and skip2 are the byte offsets from the beginning of file1 and file2, respectively, where the comparison will
begin. The offset is decimal by default, but may be expressed as an hexadecimal or octal value by preceding it with a leading ``0x'' or
``0''.
The cmp utility exits with one of the following values:
0 The files are identical.
1 The files are different; this includes the case where one file is identical to the first part of the other. In the latter case, if the
-s option has not been specified, cmp writes to standard output that EOF was reached in the shorter file (before any differences were
found).
>1 An error occurred.
SEE ALSO
diff(1), diff3(1)
STANDARDS
The cmp utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
BSD
June 6, 1993 BSD