forked from der-lolo/aquarea
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdateScript.pl
More file actions
32 lines (25 loc) · 826 Bytes
/
updateScript.pl
File metadata and controls
32 lines (25 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl
use File::Basename;
use POSIX qw(strftime);
use strict;
my @filenames = ( "67_Aquarea.pm" );
my $prefix = "FHEM";
my $filename = "67_Aquarea.pm";
foreach $filename (@filenames)
{
my @statOutput = stat($prefix."/".$filename);
if (scalar @statOutput != 13)
{
printf("error: stat has unexpected return value for ".$prefix."/".$filename."\n");
next;
}
my $mtime = $statOutput[9];
my $date = POSIX::strftime("%Y-%m-%d", localtime($mtime));
my $time = POSIX::strftime("%H:%M:%S", localtime($mtime));
my $filetime = $date."_".$time;
my $filesize = $statOutput[7];
printf("UPD ".$filetime." ".$filesize." ".$prefix."/".$filename."\n");
open (DATEI, ">controls_aquarea.txt") or die $!;
print DATEI "UPD ".$filetime." ".$filesize." ".$prefix."/".$filename."\n";
close (DATEI);
}