Thread Backup von Dateien als Cronjob (6 answers)
Opened by cbxk1xg at 2008-11-07 15:44

renee
 2008-11-07 16:15
#116061 #116061
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl

use strict;
use warnings;
use DateTime;

use constant SECONDS_PER_DAY => 24 * 60 * 60;

my $filename = "20080112BlaFasel.xys";
my ($year,$month,$day) = $filename =~ /(\d{4})(\d\d)(\d\d)/;

my $diff = DateTime->new( year => $year, month => $month, day => $day )
                   ->subtract_datetime_absolute( DateTime->now );

print $diff->seconds / SECONDS_PER_DAY;
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Backup von Dateien als Cronjob