To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.off-topic.geekOpen lugnet.off-topic.geek in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Off-Topic / Geek / 5091
5090  |  5092
Subject: 
Re: perl file copy question
Newsgroups: 
lugnet.off-topic.geek
Date: 
Wed, 5 Oct 2005 22:12:46 GMT
Viewed: 
2396 times
  
that does help! (meanwhile I got a version working that uses system(), just as a
stopgap...)

However I really don't want to use system() (or any process spawning things) and
since I want to wildcard aren't I going to have to use glob() to get an array of
filehandles? However,

http://perldoc.perl.org/functions/glob.html

says glob returns a list of filename expansions... do they mean names rather
than handles? If so, then ya, all set.

Does this code help? It shows the outputs. Decided to have a fiddle with what
Ross posted to see what everything did.

Tim

use File::Glob ':glob';
use File::Basename;

$ddn="destination directory";

@t=(<g:/docs/in_progress/nanotubes/*.*>);
foreach $f (@t)
{
    $bn=basename($f);
    $dn=dirname($f);
    print "cp $dn/$bn $ddn/$bn\n";
}



Message is in Reply To:
  Re: perl file copy question
 
(...) that does help! (meanwhile I got a version working that uses system(), just as a stopgap...) However I really don't want to use system() (or any process spawning things) and since I want to wildcard aren't I going to have to use glob() to get (...) (19 years ago, 5-Oct-05, to lugnet.off-topic.geek)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR