Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Need this $dir variable be replaced by the new one added in windows.

Reply
Thread Tools

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

 
 
king
Guest
Posts: n/a
 
      10-18-2007
#!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.

 
Reply With Quote
 
 
 
 
Josef Moellers
Guest
Posts: n/a
 
      10-18-2007
king wrote:
> #!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.

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why multiple spaces are replaced with one Saeed HTML 7 02-14-2009 12:37 PM
Any one here had there Faulty Sony CCD Deivice replaced. noone@nospamyahoo.cnn NZ Computing 6 03-29-2008 10:27 AM
Solution for posterity: GridView, Datakeys, and "Item has already been added. Key in dictionary: 'CategoryID' Key being added: 'CategoryID'" ASP .Net 2 11-02-2006 04:48 AM
how come user control added to page doesn't get added to codebehind file? Bennett Haselton ASP .Net 1 11-08-2004 09:26 PM
replaced vs non replaced Shawn Modersohn HTML 4 07-20-2004 06:58 AM



Advertisments