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

K

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.
 
J

Josef Moellers

king said:
#!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.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top