From: Sergey Matveev Date: Thu, 8 May 2025 11:46:26 +0000 (+0300) Subject: More efficient file copying X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a73e7534cf08820dfc41d7c6fb7eb0caf241cee8;p=zk.git More efficient file copying --- diff --git a/zk b/zk index bebc2ee..621cfa1 100755 --- a/zk +++ b/zk @@ -354,6 +354,7 @@ if ($ARGV[0] eq "dump") { } elsif ($ARGV[0] eq "htmls") { my $now = time; use File::Path qw(make_path); + use File::Copy; foreach my $cat (keys %cats) { make_path "$ARGV[1]/$cat"; next if (exists $mtimes{"$cat/index"}); @@ -370,11 +371,7 @@ if ($ARGV[0] eq "dump") { close $fh; @s = stat($pth) or die "$!"; utime $s[9], $s[9], "$ARGV[1]/$pth.html"; - open(my $in, "<", $pth) or die "$!"; - open(my $out, ">", "$ARGV[1]/$pth.txt") or die "$!"; - while (<$in>) { print $out $_ }; - close $out; - close $in; + copy $pth, "$ARGV[1]/$pth.txt" or die "$!"; utime $s[9], $s[9], "$ARGV[1]/$pth.txt"; } } elsif ($ARGV[0] eq "dot") {