AG87 has asked for the wisdom of the Perl Monks concerning the following question:
Hello I am basically trying to list all the files present in a given directory that ends with ".fasta" extension. But somehow I am not getting the whole file name....instead just getting the extension ".fasta", thus omitting the name of file before ".fasta" extension. However when I myself create a new file manually, say "a.fasta", it is being printed completely. Can anyone suggest me why the file created via perl code is not being grabbed by the glob function?? My code is
while(my $key = each %seqInfo) { my $nameWithoutFastaSign = $key; $nameWithoutFastaSign =~ tr/>//d; my $currentDir = getcwd; chdir "$currentDir/$nameWithoutFastaSign"; my $changedDir = getcwd; print "changed directory is: $changedDir\n"; while($fastaFile = glob("*.fasta")) { print "$fastaFile\n"; } chdir "$currentDir"; }
and the output shown is
changed directory is: /home/ammarah/Documents/code/1elwA .fasta changed directory is: /home/ammarah/Documents/code/1ghwA .fasta changed directory is: /home/ammarah/Documents/code/1flwA .fasta
There should be a complete file name, which is similar to folder name eg "1elwA.fasta" instead of simple ".fasta". Can anyone help me please??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Listing of files using glob
by Anonymous Monk on Jan 05, 2012 at 07:58 UTC | |
by AG87 (Acolyte) on Jan 05, 2012 at 08:24 UTC | |
by Anonymous Monk on Jan 05, 2012 at 08:55 UTC | |
by tobyink (Canon) on Jan 05, 2012 at 09:27 UTC | |
by Corion (Patriarch) on Jan 05, 2012 at 09:41 UTC | |
| |
by AG87 (Acolyte) on Jan 05, 2012 at 10:25 UTC | |
by choroba (Cardinal) on Jan 05, 2012 at 10:45 UTC | |
by AG87 (Acolyte) on Jan 05, 2012 at 11:02 UTC | |
by choroba (Cardinal) on Jan 05, 2012 at 11:09 UTC | |
by AG87 (Acolyte) on Jan 05, 2012 at 11:14 UTC | |
by choroba (Cardinal) on Jan 05, 2012 at 11:26 UTC | |
by AG87 (Acolyte) on Jan 05, 2012 at 11:46 UTC | |
by choroba (Cardinal) on Jan 05, 2012 at 11:50 UTC | |
| |
by choroba (Cardinal) on Jan 05, 2012 at 11:48 UTC | |
|