Quote:
Originally Posted by puzzler
[...]
I have two files,
folder 1 contains a list of around 20 files in binary (possibly treated as arrays?)
folder 2 contains several files and sub folders each entry also in binary
all i want to do is basically take each entry of folder 1 and see if there are any matching results in file 2
[...]
|
Are you talking about files or folders?? However you can compare files and/or folders using
diff.
Another possibility could be list files in folder 1 and check if they exists in folder 2. Then, use diff to compare. Something like:
Code:
LIST=files.txt
ls folder1 > $LIST #list files from folder1
cat $LIST| while read line; do #for each filename
INPUT=$(echo ${line})
cd $folder2
if [ -f $INPUT ]; then #check if file exists and its a regular file
#files exists
diff $folder1/$INPUT $folder2/$INPUT > dev/nul 2>&1 #compares both
if [ "$?" == "0" ]; then #check for result.
#files exists and they're identical
fi
fi
done