I tried the following:
#!/bin/bash
# Example: ~/compare.sh FC30-3DA9
# where $1 is the directory name
# requirement: you are in one of the two parent dirs.
# the directories to compare must have the same name
find $1 -type f -exec sh -c '
for f; do
cmp "$f" /directory/of/mr/bear/"$f"
done
' sh {} +
Seemed to work fine.# Example: ~/compare.sh FC30-3DA9
# where $1 is the directory name
# requirement: you are in one of the two parent dirs.
# the directories to compare must have the same name
find $1 -type f -exec sh -c '
for f; do
cmp "$f" /directory/of/mr/bear/"$f"
done
' sh {} +
References
- How to compare files in two folders using cmp?
- http://www.unix.com/shell-programming-and-scripting/144821-how-compare-files-two-folders-using-cmp.html
No comments:
Post a Comment