Re: get only filenames and not directory names under a specific path.

2006-07-27 Thread Alan_C
On Wednesday 26 July 2006 00:59, Rob Dixon wrote: > Hello Alan > > Alan_C wrote: > > On Tuesday 25 July 2006 15:56, Rob Dixon wrote: > >>Nishi Bhonsle wrote: [ snip ] > > [ snip ] [ snip ] > > #!/usr/bin/perl > >use strict; > >use warnings; > > > >my @dir = do { > > # opend

Re: get only filenames and not directory names under a specific path.

2006-07-26 Thread Rob Dixon
Hello Alan Alan_C wrote: > > On Tuesday 25 July 2006 15:56, Rob Dixon wrote: > >>Nishi Bhonsle wrote: >> >> > I got the last soln, ie to use File::Basename module. Please ignore the >> > last thread. >> > >> > I am still interested to know why Rob's soln doesnt work for me? >> >>So was I, and it'

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Alan_C
On Tuesday 25 July 2006 15:56, Rob Dixon wrote: > Nishi Bhonsle wrote: > > I got the last soln, ie to use File::Basename module. Please ignore the > > last thread. > > > > I am still interested to know why Rob's soln doesnt work for me? > > So was I, and it's because I made a mistake. Because t

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Dr.Ruud
"Nishi Bhonsle" schreef: [don't! top-post!] > [IO:All] > Currently, it prints > C:\..\..\..\File1.txt > etc > I really want it only print File1.txt I don't understand how you read the documentation. Just search for 'filename'. And start to grok the 'All' in IO::All. -- Affijn, Ruud "Gewoon i

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Rob Dixon
Nishi Bhonsle wrote: > > I got the last soln, ie to use File::Basename module. Please ignore the > last thread. > > I am still interested to know why Rob's soln doesnt work for me? So was I, and it's because I made a mistake. Because the values returned by readdir don't include a full path, the

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
I got the last soln, ie to use File::Basename module. Please ignore the last thread. I am still interested to know why Rob's soln doesnt work for me? Thanks much! On 7/25/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Hi: In addition can i modify the all_files to return only the absolute fil

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
Hi: In addition can i modify the all_files to return only the absolute filename and not the filename alongwith the entire path? Currently, it prints C:\..\..\..\File1.txt etc I really want it only print File1.txt Thanks! On 7/25/06, Nishi Bhonsle <[EMAIL PROTECTED]> wrote: Yes, all_files wo

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Nishi Bhonsle
Yes, all_files works. Its in the doc, and i missed it. Its my bad. Rob, I tried the code snippet you mentioned, apparently it doesnot return anything under the directory. Thanks, Nishi. On 7/25/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: Rob Dixon schreef: >use strict; >use warnings; > >

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Dr.Ruud
Rob Dixon schreef: >use strict; >use warnings; > >my @dir = do { > opendir my $dh, 'C:\build\Sample\NewDir' or die $!; > grep -f, readdir $dh; For newbies, maybe put a comment here that the closedir() is implicit. >}; > >print "$_\n" foreach @dir; -- Affijn, Ruud

Re: get only filenames and not directory names under a specific path.

2006-07-25 Thread Rob Dixon
Nishi Bhonsle wrote: > > I am not able to get the files at just the first level. > ie > print "$_\n" for $io->all(0); prints all level down > and > print "$_\n" for $io->all(1); prints the files and the dir name at the > first level > ie > issuing the command for path C:\build\Sample\NewDir > p

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Dr.Ruud
"Nishi Bhonsle" schreef: > I am not able to get the files at just the first level. > ie > print "$_\n" for $io->all(0); prints all level down > and > print "$_\n" for $io->all(1); prints the files and the dir name at > the first level "All" and "all(0)" are the same. "all" and "all(1)" are t

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Mumia W.
On 07/24/2006 06:35 PM, Nishi Bhonsle wrote: Hi: If I need to get the files without the "." and the ".." at the first level only, [...] use File::Slurp; my @files = read_dir('mydirectory'); Do you have the perl documentation installed? This should give you information about File::Slurp: perl

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
Hi: I am not able to get the files at just the first level. ie print "$_\n" for $io->all(0); prints all level down and print "$_\n" for $io->all(1); prints the files and the dir name at the first level ie issuing the command for path C:\build\Sample\NewDir prints the below C:\build\Sample\NewDi

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Dr.Ruud
"Nishi Bhonsle" schreef: > If I need to get the files without the "." and the ".." at the first > level only, then how can i modify the find command? > ie > Currently using find(sub {push(@new,$_) if ( -f ) }, $path); gives > me all files under NewDir as well as NewSubDirectory > C:\build\Sample

Re: get only filenames and not directory names under a specific path.

2006-07-24 Thread Nishi Bhonsle
Hi: If I need to get the files without the "." and the ".." at the first level only, then how can i modify the find command? ie Currently using find(sub {push(@new,$_) if ( -f ) }, $path); gives me all files under NewDir as well as NewSubDirectory C:\build\Sample\NewDir\File1.txt C:\build\Sample\

Re: get only filenames and not directory names under a specific path.

2006-07-22 Thread Dr.Ruud
"Wagner, David --- Senior Programmer Analyst --- WGO" schreef: > if ( !/^\.{1,2}/ ) That would fail "..x" &c. If you are only interested in files and not directories, use -f. -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
That works like a charm, thanks! -Nishi. On 7/21/06, Wagner, David --- Senior Programmer Analyst --- WGO < [EMAIL PROTECTED]> wrote: Nishi Bhonsle wrote: > I tried it but didnt work. > my @new; > > find(sub {push @new, $_}, $path); find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path);

RE: get only filenames and not directory names under a specific path.

2006-07-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Wagner, David --- Senior Programmer Analyst --- WGO wrote: > Nishi Bhonsle wrote: >> I tried it but didnt work. >> my @new; >> >> find(sub {push @new, $_}, $path); > find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path); > > If not 1 or 2 periods push on to @new; > Wags ;) So

RE: get only filenames and not directory names under a specific path.

2006-07-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Nishi Bhonsle wrote: > I tried it but didnt work. > my @new; > > find(sub {push @new, $_}, $path); find(sub {push(@new,$_) if ( !/^\.{1,2}/ ) }, $path); If not 1 or 2 periods push on to @new; Wags ;) > > open FILE,">>$logfile"; > > print FILE "$_\n" foreach @new; > close FI

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Nishi Bhonsle
I tried it but didnt work. my @new; find(sub {push @new, $_}, $path); open FILE,">>$logfile"; print FILE "$_\n" foreach @new; close FILE; In addition to printing filenames and directories, it also printed the "." The log file contained . file1.txt file2.txt How can I not include the "." ?

Re: get only filenames and not directory names under a specific path.

2006-07-21 Thread Rob Dixon
Nishi Bhonsle wrote: Hi: I am starting a new thread based of an older thread just because there was a lot of different things that were requested for and it had gotten a bit confusing. I got a lot of help from all you experts to write the below code that takes an argument path C:\build\Sample\

Re: get only filenames and not directory names under a specific path.

2006-07-20 Thread Edi STOJICEVIC
Le jeu, jui 20, 2006 at 09:36:02 -0700, Nishi Bhonsle a tapoté sur son clavier : > Hi: > I am starting a new thread based of an older thread just because there was a > lot of different things that were requested for and it had gotten a bit > confusing. > > I got a lot of help from all you experts