]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/Tools.pm
add function file_copy
[pve-common.git] / src / PVE / Tools.pm
index 125c3073f0a2b32fb1cfc2185cbd47e4285305f0..ba3f13702bff4faf2409e4b78ae35bd35675d012 100644 (file)
@@ -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) = @_;