Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
ruby common-files.rb dir1 dir2
## Find files common to two directories.
## Descend into subdirectories.
lists = [ Hash.new { [] }, Hash.new { [] } ]
for i in 0 .. 1
Dir[ ARGV[i] + "/**/*" ].each{|path|
lists[i][
[ File.basename(path), File.size(path) ]
] += [ path ] if File.file?( path )
}
end
lists.first.each_key { |key|
if lists.last.include?( key )
puts "--- #{ key[0,2].join(' ') } bytes"
puts lists.first[ key ], lists.last[ key ]
end
}
find . -type f -exec sum {} \;|\
sort|\
awk '{
if ((lsum == $1) && (lblks == $2)){
if (lfile != "" ) {
print lfile
lfile=""
blank="yes"
}
print $3
}
else {
if (blank == "yes") {
print ""
}
lsum=$1
lblks=$2
lfile=$3
}
}'