Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using this right now:

time md5sum -c *.txt | pv | grep -v ': OK$'

but aren't there any smart solutions that can list that how many files haven't been checked? I mean I have many md5sum's in .txt files in a dir, and I need to check them, but it would be a good thing to know that how much files are left to scan..

p.s.: so it's not really a progress bar, just a counter that output how many files are there left to "md5sum -c FILENAME"..

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You could pass the names to md5sum one by one.

n=$(cat *.txt | wc -l)
cat *.txt | {
  i=0 bad=0
  while IFS= read -r line; do
    i=$((i+1))
    echo "Checking file $i/$n: $line"
    echo "$line" | md5sum -c - || bad=$((bad+1))
  done
  [ $bad -eq 0 ] || { echo "$bad bad checksums"; false; }
}

Or, for casual use, you can run the simple command and check which file md5sum is up to by seeing what it has open.

lsof -p1234
# note the file name
cat *.txt | grep -n FILENAME
share|improve this answer
    
thanks, it's almost perfect :P i upgraded/downgraded it a little bit: pastebin.com/raw.php?i=eqfiXzaB –  LanceBaynes Jul 17 '11 at 14:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.