]> git.proxmox.com Git - pve-common.git/commitdiff
add function file_copy
authorWolfgang Link <w.link@proxmox.com>
Wed, 25 Nov 2015 09:18:17 +0000 (10:18 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 26 Nov 2015 07:08:31 +0000 (08:08 +0100)
to have a save copy.

src/PVE/Tools.pm

index 125c3073f0a2b32fb1cfc2185cbd47e4285305f0..ba3f13702bff4faf2409e4b78ae35bd35675d012 100644 (file)
@@ -41,6 +41,7 @@ template_replace
 safe_print
 trim
 extract_param
 safe_print
 trim
 extract_param
+file_copy
 );
 
 my $pvelogdir = "/var/log/pve";
 );
 
 my $pvelogdir = "/var/log/pve";
@@ -220,6 +221,12 @@ sub file_get_contents {
     return $content;
 }
 
     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) = @_;
 
 sub file_read_firstline {
     my ($filename) = @_;