Take 2 (no more one liner and slick like WATANABE's next post) :

require 'digest/md5'
ARGV.each{|f|
begin
    printf("%30s : ",f); puts Digest::MD5.hexdigest(File.read(f)) ;
#            ^^^^^
#  Assuming no file names are lareger than 30 chars
rescue
   puts "....skipping (may be dir or Access denied)"
   next
end
}

"Shashank Date" <sdate / kc.rr.com> wrote in message
news:X8nN9.15609$Zt4.173973 / twister.rdc-kc.rr.com...
>
> "MikkelFJ" <mikkelfj-anti-spam / bigfoot.com> wrote in message
> > fails on directories though
>
> ruby -r digest/md5 -le "ARGV.each{|f| (print f, ' ',
> Digest::MD5.hexdigest(open(f, 'rb').read)) unless
File.stat(f).directory? }"
> *
>
> But this will still fail on files which do not have access, like on my
> machine (Win XP Pro):
>
> ruby 1.7.3 (2002-11-17) [i386-mswin32]
>
> -e:1:in `initialize': Permission denied - "hiberfil.sys" (Errno::EACCES)
>         from -e:1:in `open'
>
>