There are thousands of files in my src folder.I have src and src_temp folders name, both are same in terms of files but files cksum may differ.
I want to compare files in the folder against cksum so that i can see which files are different.
Please let me know the way.
I checked this link as well but dont know which one is good to check thousands of files.
Found :
$ # 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
then diff of files.. .there are thousands of file. Can we have any other good approach
Files:
$ cat f1/foo.txt
foo
$ cat f1/bar.txt
bar
$ cat f2/foo.txt
fooX
$ cat f2/bar.txt
bar
Script:
for f in f1/*
do
b=$(basename $f)
m1=$(md5sum f1/$b | cut -d' ' -f1)
m2=$(md5sum f2/$b | cut -d' ' -f1)
if [ "$m1" != "$m2" ]
then
echo $b is different
fi
done
Output:
foo.txt is different