rename -> myrename for HandleArchiving
git-svn-id: https://svn.fhem.de/fhem/trunk@334 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
27
fhem/fhem.pl
27
fhem/fhem.pl
@@ -149,7 +149,7 @@ my %intAt; # Internal at timer hash.
|
|||||||
my $nextat; # Time when next timer will be triggered.
|
my $nextat; # Time when next timer will be triggered.
|
||||||
my $intAtCnt=0;
|
my $intAtCnt=0;
|
||||||
my $AttrList = "room comment";
|
my $AttrList = "room comment";
|
||||||
my $cvsid = '$Id: fhem.pl,v 1.65 2009-01-14 19:16:59 rudolfkoenig Exp $';
|
my $cvsid = '$Id: fhem.pl,v 1.66 2009-01-15 09:13:42 rudolfkoenig Exp $';
|
||||||
my $namedef =
|
my $namedef =
|
||||||
"where <name> is either:\n" .
|
"where <name> is either:\n" .
|
||||||
"- a single device name\n" .
|
"- a single device name\n" .
|
||||||
@@ -1902,6 +1902,29 @@ doGlobalDef($)
|
|||||||
CommandAttr(undef, "global version =VERS= from =DATE= ($cvsid)");
|
CommandAttr(undef, "global version =VERS= from =DATE= ($cvsid)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#####################################
|
||||||
|
# rename does not work over Filesystems: lets copy it
|
||||||
|
sub
|
||||||
|
myrename($$)
|
||||||
|
{
|
||||||
|
my ($from, $to) = @_;
|
||||||
|
|
||||||
|
if(!open(F, $from)) {
|
||||||
|
Log(1, "Rename: Cannot open $from: $!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!open(T, ">$to")) {
|
||||||
|
Log(1, "Rename: Cannot open $to: $!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
while(my $l = <F>) {
|
||||||
|
print T $l;
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
close(T);
|
||||||
|
unlink($from);
|
||||||
|
}
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# Make a directory and its parent directories if needed.
|
# Make a directory and its parent directories if needed.
|
||||||
sub
|
sub
|
||||||
@@ -1943,7 +1966,7 @@ HandleArchiving($)
|
|||||||
for(my $i = 0; $i < $max; $i++) {
|
for(my $i = 0; $i < $max; $i++) {
|
||||||
if($ard) {
|
if($ard) {
|
||||||
Log 2, "Moving $files[$i] to $ard";
|
Log 2, "Moving $files[$i] to $ard";
|
||||||
rename("$dir/$files[$i]", "$ard/$files[$i]");
|
myrename("$dir/$files[$i]", "$ard/$files[$i]");
|
||||||
} else {
|
} else {
|
||||||
Log 2, "Deleting $files[$i]";
|
Log 2, "Deleting $files[$i]";
|
||||||
unlink("$dir/$files[$i]");
|
unlink("$dir/$files[$i]");
|
||||||
|
|||||||
Reference in New Issue
Block a user