From 7614143c17034555a2fbe8a7eec5796f15676a37 Mon Sep 17 00:00:00 2001 From: betateilchen <> Date: Fri, 10 Feb 2017 20:03:09 +0000 Subject: [PATCH] 98_configdb.pm: add fileexport all git-svn-id: https://svn.fhem.de/fhem/trunk@13380 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_configdb.pm | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/fhem/FHEM/98_configdb.pm b/fhem/FHEM/98_configdb.pm index 9ffdf4c81..fd6f2451b 100644 --- a/fhem/FHEM/98_configdb.pm +++ b/fhem/FHEM/98_configdb.pm @@ -134,14 +134,28 @@ sub CommandConfigdb($$) { when ('fileexport') { return "\n Syntax: configdb fileexport " if @a != 2; - my $filename; - if($param1 =~ m,^[./],) { - $filename = $param1; - } else { - $filename = $attr{global}{modpath}; - $filename .= "/$param1"; - } - $ret = _cfgDB_Fileexport $filename; + if ($param1 ne 'all') { + my $filename; + if($param1 =~ m,^[./],) { + $filename = $param1; + } else { + $filename = $attr{global}{modpath}; + $filename .= "/$param1"; + } + $ret = _cfgDB_Fileexport $filename; + } else { # start export all + my $flist = _cfgDB_Filelist(1); + my @filelist = split(/\n/,$flist); + undef $flist; + foreach my $f (@filelist) { + Log3 (4,undef,"configDB: exporting $f"); + my ($path,$file) = $f =~ m|^(.*[/\\])([^/\\]+?)$|; + $path = "/tmp/$path"; + eval qx(mkdir -p $path) unless (-e "$path"); + $ret .= _cfgDB_Fileexport $f; + $ret .= "\n"; + } + } # end export all } when ('fileimport') { @@ -498,7 +512,7 @@ compare device: telnetPort in current version 0 (left) to version: 1 (right)

-
  • configdb fileexport <targetFilename>

  • +
  • configdb fileexport <targetFilename>|all

  • Exports specified fhem file from database into filesystem.
    Example: