well, first of all you want to take this open statement out of the 'for loop' and
declare it before the loop starts:
$resultat="c:\\resultat.txt";
open (RESULT, ">>$resultat");

not sure why the file existance check isn't working.. you might want to add some
print statements, or maybe try and open such a file manually etc to see if you
have specified all locations properly....

hth
Jos Boumans

[EMAIL PROTECTED] wrote:

> I want to do this :
>
> I have a file where there are 256 servers names, one server name per line.
> I want to read all lines to take the names of all servers to check the size of
> some files ...
>
> I tried this but it's not working like I want .. :
>
> $serveur="c:\\perl\\bin\\liste.txt";
> open (SERV, "$serveur");
> @serveurs = <SERV>;
> close (SERV);
>
> foreach $ligne (@serveurs)
> {
> $fichier="\\\\$ligne\\f\$\\cmd\\active.vbs";
> $fichier2="\\\\$ligne\\f\$\\universe\\data\\exp\\upr\\upe_dsms.000";
> $fichier3="\\\\$ligne\\f\$\\universe\\data\\exp\\upr\\upe_psms.000";
> $fichier4="\\\\$ligne\\g\$\\common\\bin\\upecbootnt.cmd";
>
> if (-e $fichier)
>         {
>         $size=(stat $fichier)[7];
>         print RESULT"$fichier fait $size octets\n";
>         }
>         else
>         {
>         print RESULT"$fichier inexistant \n";
>         }
>
>         if (-e $fichier2)
>         {
>         $size2=(stat $fichier2)[7];
>         print RESULT"$fichier2 fait $size2 octets\n";
>         }
>         else
>         {
>         print RESULT"$fichier2 inexistant \n";
>         }
>
> if (-e $fichier3)
>         {
>         $size3=(stat $fichier3)[7];
>         print RESULT"$fichier3 fait $size3 octets\n";
>         }
>         else
>         {
>         print RESULT"$fichier3 inexistant \n";
>         }
>
> if (-e $fichier4)
>         {
>         $size4=(stat $fichier4)[7];
>         print RESULT"$fichier4 fait $size4 octets \n";
>         }
>         else
>         {
>         print RESULT"$fichier4 inexistant \n";
>         }
>
> $resultat="c:\\resultat.txt";
> open (RESULT, ">>$resultat");
>
>  }
>
> With this i have some probleme because when i try to do store the data in the
> file c:\resultat.txt it's taking only the last server name in the list.txt
> and is not checking the size of the files ...
>
> If someone can help me ...
>
> Thanx

Reply via email to