[pve-devel] [PATCH V2 pve-common] add function file_copy

Wolfgang Link w.link at proxmox.com
Wed Nov 25 10:18:17 CET 2015


to have a save copy.
---
 src/PVE/Tools.pm | 7 +++++++
 1 file changed, 7 insertions(+)

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) = @_;
 
-- 
2.1.4





More information about the pve-devel mailing list