Leser: 16
1 2 3 4 5
use File::Copy qw(move); my $svr = 'SERVER'; my $htmlFilename = 'Datei.html'; move("\\\\$svr\\e\$\\Share\\Logs\\events\\$htmlFilename", "C:\\BackupEventLogs\\$svr\\$htmlFilename") || die " $!";
1 2 3 4 5 6 7 8 9 10 11
use Win32::OLE; my $net=Win32::OLE->CreateObject("Wscript.Network"); $net->MapNetworkDrive("Y:","\\\\server\\path",0,"USERID","PASSWORD"); # deine Kopierroutine auf das Laufwerk Y: # melde Laufwerk wieder ab $net->RemoveNetworkDrive("Y:",1,0); $net = '';
if (! -e "Y:\\")
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
use strict; use warnings; use Win32 (); use Cwd; use File::Copy qw(copy); use File::Copy qw(move); use Win32::OLE; ######Globale Variablen##### my $workingdir = getcwd; my $logserver = 'webspace'; my $logserverpath = 'homepage\\share\\logs\\events'; my $server = 'test'; my $htmlFilename = 'abc.html'; my $txtDomain = 'Simple'; my $txtUser = 'user'; my $txtPasswort = 'abcdefg'; my $DomainUser = $txtDomain.'\\'.$txtUser; my $save_dir = $workingdir.'\\AuswertungEventlogs\\'.$server.'\\'.$htmlFilename; my $net=Win32::OLE->CreateObject("Wscript.Network"); if (! -e "Y:\\") { $net->MapNetworkDrive("Y:","\\\\$logserver\\$logserverpath",0,"$DomainUser","$txtPasswort"); move("Y:\\$htmlFilename","$save_dir") or die "Copy failed: $!"; $net->RemoveNetworkDrive("Y:",1,0); # melde Laufwerk wieder ab $net = ''; } else { print "Logdatein können nicht vom Server kopiert werden, bitte trennen Sie Laufwerk Y: !\n" }
QuoteCopy failed: No such file or directory at C:\Documents and Settings\My Documents\APP\Log a
uswerten\dreck.pl line 26.
move("Y:\\$htmlFilename","$save_dir") or die "Copy failed: $!";
1 2
(-e "Y:\\$htmlFilename") or die "File nonexistent: Y:\\$htmlFilename"; move("Y:\\$htmlFilename","$save_dir") or die "Move failed: $!";
2010-12-01T07:37:30 GwenDragonDu wirst dir die Datei wohl "weggemovet" haben. Move kopiert und löscht dann auf dem Quelllaufwerk.
Zeile 26:
Ersetze
durchCode (perl): (dl )move("Y:\\$htmlFilename","$save_dir") or die "Copy failed: $!";Code (perl): (dl )1 2(-e "Y:\\$htmlFilename") or die "File nonexistent: Y:\\$htmlFilename"; move("Y:\\$htmlFilename","$save_dir") or die "Move failed: $!";
system("C:\\Program Files\\Internet Explorer\\iexplore.exe C:\\Documents and Settings\\My Documents\\APP\\Log auswerten\\2010-11-23.html");