Thread File::Find System error 85 has occurred / The local device name is already in use
(20 answers)
Opened by provisoft at 2017-05-19 14: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 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 #!perl.exe use CGI qw(param); use strict; use warnings; use File::Find; use Win32API::File qw(:ALL); use File::stat; #-------------------------------------------------------- # Alle gemappten Laufwerke ausgeben #-------------------------------------------------------- my @drives = getLogicalDrives(); foreach (@drives) { $lauf = $lauf . "$_\n"; }; $gbsum = ''; $mbsum = ''; $mb = ''; $used = ''; $anzahldateien = ''; @arr = ''; $filesize = ''; $start_dir = ''; $qs_srv_adr = ''; #---------------------------------------------------- # Laufwerk mappen #---------------------------------------------------- my $qs_srv_adr = "xxx" . '\\' . "yyy"; my $pwd = "ppp"; my $user = "uuu"; system("net use * /delete /" . "y"); my $netuse = 'net use ' . "y" . ': \\\\' . $qs_srv_adr . ' ' . $pwd . ' /user:' . $user . ' /persistent:no'; system($netuse); $start_dir = "y" . ":/"; my $s = qx(net share); if ($s =~ m/Users/) { print "Share USERS ist belegt"; }; eval { find(\&find_parm, $start_dir); }; if ($@) { # nach eval stehen in $@ stehen Meldungen wenn was fehlschlug # hier Fehlermeldung des eval auswerten }; $anzahldateien = @dir_entries; $gbsum = $mbsum / 1024; $used = (100 * $gbsum) / "y"; sub find_parm { my $akt_file = $File::Find::name; push @dir_entries, $akt_file; my @arr = stat ("$akt_file"); #my @fileProps = stat($akt_file) or die "stat of $akt_file failed!: $!"; #use Data::Dumper; #print ( LOGF "DEBUG###\n", Dumper(\@fileProps), "\n####\n"); $filesize = ''; $filesize = $arr[7]; $mb = ''; $mb = ($filesize / 1024) / 1024; $mbsum = $mbsum + $mb; }; |