local $/=undef;
open (IN, $file) || error("failed to read $file: $!");
binmode(IN) if ($binary);
local $/=undef;
open (IN, $file) || error("failed to read $file: $!");
binmode(IN) if ($binary);
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
binmode(OUT) if ($binary);
open (OUT, ">$destdir/$file") || error("failed to write $destdir/$file: $!");
binmode(OUT) if ($binary);