Need this $dir variable be replaced by the new one added in windows.

Need this $dir variable be replaced by the new one added in windows.

am 18.10.2007 14:09:50 von king

#!c:\Perl\bin\perl.exe
use Strict;
use File::Copy;
#use File::find;
$dir = "2.00.A07";
print "enter the name of the file to be copied:";
$file=<>;
chomp $file;
$filetobecopied = "//Builds/Prerelease/$dir/$file";

$newfile = "C:/PERL";
copy ($filetobecopied,$newfile) or print "file not found\n";

#find(\&wanted, @directories);

This $dir i.e 2.00.A07 is changing on daily basis.Means new
directories is getting added So how can this be detected that a new
dir has been added and the $dir will replaced by the new one.

Re: Need this $dir variable be replaced by the new one added in windows.

am 18.10.2007 15:33:55 von Josef Moellers

king wrote:
> #!c:\Perl\bin\perl.exe
> use Strict;
> use File::Copy;
> #use File::find;
> $dir =3D "2.00.A07";
> print "enter the name of the file to be copied:";
> $file=3D<>;
> chomp $file;
> $filetobecopied =3D "//Builds/Prerelease/$dir/$file";
>=20
> $newfile =3D "C:/PERL";
> copy ($filetobecopied,$newfile) or print "file not found\n";
>=20
> #find(\&wanted, @directories);
>=20
> This $dir i.e 2.00.A07 is changing on daily basis.Means new
> directories is getting added So how can this be detected that a new
> dir has been added and the $dir will replaced by the new one.

Use a globbing operator to get all names that match the directory name=20
pattern and then apply whatever algorithm is necessary to find the=20
latest one.

--=20
These are my personal views and not those of Fujitsu Siemens Computers!
Josef Möllers (Pinguinpfleger bei FSC)
If failure had no penalty success would not be a prize (T. Pratchett)
Company Details: http://www.fujitsu-siemens.com/imprint.html