MD5 File Parsing

Hey Guys.
Here is another issue I'm struggling with: :wall:
I need wget to download only the files that has been changed. I use md5deep to generate the check sum files.

Here is a simple result; I'll call it $string for the example

0ce73169b069d11e38d6bd78796839c0  md5data
78cb11f2d943b48b8d5a00931cc454b1  md5rss
86ffb6728305730996451e43effa1738  myTextFile.txt
f385d56f26ca3859f48bd450c3e214bf  rss.txt

if I set -- $string , i can access each argument by using $# (where # is 1,2,3,etc..)

so:
echo $1 will print 0ce73169b069d11e38d6bd78796839c0
echo $2 will print md5data

however I'm not sure how to write $# in a for loop that will go through all of them.

So here is the logic of the loop I'm trying to create:

for I ; 1 to [number of arguments in the file] do; step 2
if $i != $string than download file $(i+1); end if
end for.

Any suggestions (or better ways to check md5 files and download only the files that are different?)

Thanks

Ok, guess you have the md5 list file: md5_total.txt With below codes, you can find out the files list which are changed.

MD5FILE=/XXX/md5_total.txt

cd /DIR1 
find . -type f -exec md5deep {} \; > new_md5.txt

diff <(sort -k2 $MD5FILE) <(sort -k2 $new_md5.txt) |awk '/</' {print $NF}'