Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Batch processing files in a directory

by Kenosis (Priest)
on Feb 13, 2013 at 20:47 UTC ( #1018632=note: print w/ replies, xml ) Need Help??

in reply to Batch processing files in a directory

Here's another option:

use strict; use warnings; for my $file (<*.ptseq>) { my ($baseName) = $file =~ /^(.+)\.[^.]+$/; my $textFile1 = $baseName . '1.txt'; my $textFile2 = $baseName . '2.txt'; print "$file ->\t$textFile1\t$textFile2", "\n"; }

Output from my dir:

fileA.ptseq -> fileA1.txt fileA2.txt fileB.ptseq -> fileB1.txt fileB2.txt fileC.ptseq -> fileC1.txt fileC2.txt fileD.ptseq -> fileD1.txt fileD2.txt

Comment on Re: Batch processing files in a directory
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018632]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-11-25 14:00 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (677 votes), past polls