From: Wolfgang Link Date: Wed, 25 Nov 2015 09:18:17 +0000 (+0100) Subject: add function file_copy X-Git-Url: https://git.proxmox.com/?p=pve-common.git;a=commitdiff_plain;h=23e0e0d7868aa44b1f5d819ce0f30e78f28f28b6 add function file_copy to have a save copy. --- diff --git a/src/PVE/Tools.pm b/src/PVE/Tools.pm index 125c307..ba3f137 100644 --- a/src/PVE/Tools.pm +++ b/src/PVE/Tools.pm @@ -41,6 +41,7 @@ template_replace safe_print trim extract_param +file_copy ); my $pvelogdir = "/var/log/pve"; @@ -220,6 +221,12 @@ sub file_get_contents { return $content; } +sub file_copy { + my ($filename, $dst, $max, $perm) = @_; + + file_set_contents ($dst, file_get_contents($filename, $max), $perm); +} + sub file_read_firstline { my ($filename) = @_;