Thread Dateioperation copy und remove
(4 answers)
Opened by SimplyFred at 2008-02-26 12:52 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/usr/bin/perl use strict; use warnings; use MIME::Lite; use File::Copy qw(copy); my $dir = '/verzeichnis/'; my $file = $dir . 'tttt.txt'; if( -e $file ){ my ($d,$m,$y) = (localtime time)[3..5]; my $date = sprintf "%02d%02d%04d", $d,$m+1,$y+1900; my $new = 'tttt' . $date . '.bak'; copy $file, $new; } else{ my $mail = MIME::Lite->new( From => 'any_address@domain.example', To => 'chef@domain.example', Subject => 'tttt.txt nicht da', Data => 'Gude Chef, tttt.txt ist nicht da!', ); $mail->send; } 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/ |