From a73e7534cf08820dfc41d7c6fb7eb0caf241cee8 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Thu, 8 May 2025 14:46:26 +0300 Subject: [PATCH] More efficient file copying --- zk | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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") { -- 2.48.1