Re: Can not get reliable output [WAS: Reg. Directory listing program]

2008-06-08 Thread Michelle Konzack
Hello John, Am 2008-06-06 11:06:09, schrieb John W. Krahn: > $ perl -le'printf "%o\n", 33279' > 100777 > > > 33279 is the decimal representation of a number, and 0777 is the octal > representation of a number. If a number has a leading zero it is > usually displayed in octal representation. >

Re: Reg. Directory listing program

2008-06-06 Thread John W. Krahn
Gunwant Singh wrote: Hi, Hello, Let me thank you for your help. I think you guys are doing a great work, its really appreciative. Thanks to David and John. Now that I changed my *"perl"* code to the following, its actually working *use strict; use warnings; use File::stat; opendir (DH,

Re: Can not get reliable output [WAS Reg. Directory listing program]

2008-06-06 Thread John W. Krahn
Michelle Konzack wrote: Hello, Hello, I have a similar problem but with "mode" which output weird permissions: [ '~/bin/.perl_test_001' ]-- #!/usr/bin/perl use strict; use warnings; use File::stat; opendir(DH, "/home/michelle.konzack/bin") || die

Reg. Directory listing program

2008-06-06 Thread Gunwant Singh
at C:\Documents a nd Settings\Myself\Desktop\code\dir-op.pl line 8. What am I doing wrong! Thanks. -- Gunwant Singh --- > -Original Message- > From: Gunwant Singh [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 04,

Re: Reg. Directory listing program

2008-06-04 Thread John W. Krahn
Wagner, David --- Senior Programmer Analyst --- WGO wrote: From: Wagner, David --- Senior Programmer Analyst --- WGO From: Gunwant Singh [mailto:[EMAIL PROTECTED] 9 print "$file\t$perm\n"; Then change print to printf "$file %04o\n", $perm; Better to do it this way:

Re: Reg. Directory listing program

2008-06-04 Thread John W. Krahn
Gunwant Singh wrote: Hi, Hello, I am new to this mailing list and I am very new to PERL. perldoc -q "What.s the difference between .perl. and .Perl.?" So, please bear with me for my questions. I wrote a code that lists files in a directory with the permissions. I am coding for MS-Windows

RE: Reg. Directory listing program

2008-06-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Wagner, David --- Senior Programmer Analyst --- WGO > [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 04, 2008 11:08 > To: Gunwant Singh; beginners@perl.org > Subject: RE: Reg. Directory listing program > > > -Original Mes

RE: Reg. Directory listing program

2008-06-04 Thread Wagner, David --- Senior Programmer Analyst --- WGO
> -Original Message- > From: Gunwant Singh [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 04, 2008 10:02 > To: beginners@perl.org > Subject: Reg. Directory listing program > > Hi, > > I am new to this mailing list and I am very new to PERL. So, >

Reg. Directory listing program

2008-06-04 Thread Gunwant Singh
Hi, I am new to this mailing list and I am very new to PERL. So, please bear with me for my questions. I wrote a code that lists files in a directory with the permissions. I am coding for MS-Windows. Here is my code: *1 use strict; 2 use warnings; 3 use File::stat(); 4 5 opendir (DH, "subcode") o

Re: PC Directory Listing in Perl

2007-11-04 Thread Tom Phoenix
On 11/3/07, AndrewMcHorney <[EMAIL PROTECTED]> wrote: > Right now my code reads : > > @file_list = `cd c:\;dir c:/s`; I think that's your problem: If you were to print that same string you've got in backticks... print "The command is: " . "cd c:\;dir c:/s" . "\n"; ...you would see that you're

PC Directory Listing in Perl

2007-11-04 Thread AndrewMcHorney
Hello I am working on a perl script in which I want a complete directory listing of a drive partition. How can this be done in Perl? Right now my code reads : @file_list = `cd c:\;dir c:/s`; However I am getting the following error message: Extracting files in directoryThe filename

Re: Perl directory listing program

2007-06-13 Thread Chas Owens
On 6/13/07, John W. Krahn <[EMAIL PROTECTED]> wrote: Dr.Ruud wrote: > [EMAIL PROTECTED] schreef: > >> I need a program that will list all of the files in a directory. >> Without any arguments the program will list only the files (not >> directories) in the current directory. But I must have some

Re: Perl directory listing program

2007-06-13 Thread John W. Krahn
Dr.Ruud wrote: [EMAIL PROTECTED] schreef: I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have some command line options: [...] Might be a 1-liner with usage of

Re: Perl directory listing program

2007-06-13 Thread Dr.Ruud
[EMAIL PROTECTED] schreef: > I need a program that will list all of the files in a directory. > Without any arguments the program will list only the files (not > directories) in the current directory. But I must have some > command line options: [...] Might be a 1-liner with usage of IO::All.

Re: Perl directory listing program

2007-06-12 Thread [EMAIL PROTECTED]
On Jun 12, 5:26 pm, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote: > Looking for some help here you perl geniuses you : ) > > I need a program Sorry, I think you are in the wrong place. Here we help people who want to learn Perl. (People who want bespoke ad-hoc programs written for free are general

Re: Perl directory listing program

2007-06-12 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Looking for some help here you perl geniuses you : ) I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have some command line options: -d i

Re: Perl directory listing program

2007-06-12 Thread Chas Owens
On 6/12/07, Beginner <[EMAIL PROTECTED]> wrote: snip perldoc -f format # For an alternative way to format some headers. snip I would suggest using Perl6::Form instead of the built-in format handling. The built-in format pretty much forces you to use bad style. * http://

Re: Perl directory listing program

2007-06-12 Thread Beginner
On 12 Jun 2007 at 16:26, [EMAIL PROTECTED] wrote: > Looking for some help here you perl geniuses you : ) > > I need a program that will list all of the files in a directory. > Without any arguments the program will list only the files (not > directories) in the current directory. But I must have

Perl directory listing program

2007-06-12 Thread [EMAIL PROTECTED]
Looking for some help here you perl geniuses you : ) I need a program that will list all of the files in a directory. Without any arguments the program will list only the files (not directories) in the current directory. But I must have some command line options: -d if no argument is given, the

Re: Looking for a faster way of getting a directory listing from a disk

2006-07-14 Thread Dr.Ruud
Rob Dixon schreef: >chomp (my @files = qx($command)); >chomp @files; Why twice? >print "$_\n" foreach @files; unchomp? ;) Variant: { local ($\, $,) = ("\n", "\n"); print @files } -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] Fo

Re: Looking for a faster way of getting a directory listing from a disk

2006-07-14 Thread Rob Dixon
Ed Panni wrote: > > I was wondering if there is a quicker way of getting a directory listing > from a disk. I am currently doing the following but it takes a bit of > time if I happen to have to search multiple 250Gb drives. > > # Trying to locate tests on the systems disks and

RE: Looking for a faster way of getting a directory listing from a disk

2006-07-14 Thread Charles K. Clarkson
Ed Panni wrote: : I was wondering if there is a quicker way of getting a directory : listing from a disk. I am currently doing the following but it : takes a bit of time if I happen to have to search multiple 250Gb : drives. You are searching through a lot of files. Perhaps the best way to

Looking for a faster way of getting a directory listing from a disk

2006-07-14 Thread Ed Panni
I was wondering if there is a quicker way of getting a directory listing from a disk. I am currently doing the following but it takes a bit of time if I happen to have to search multiple 250Gb drives. # # Trying to locate tests on the systems disks and establish paths to them"; # $

Re: Directory Listing

2004-04-21 Thread gohaku
On Apr 21, 2004, at 6:09 AM, Ryan Thomas wrote: I am relatively new at PERL and am learning it for a school project. What I would like to do is write a perl script that can run a complete directory listing including sub-directories and save the result to a text file. Not sure where to start

Re: Directory Listing

2004-04-21 Thread Jan Eden
Hi Jane, - Original Message - From: Ryan Thomas Sent: 21.04.2004, 11:09 Uhr >I am relatively new at PERL and am learning it for a school project. What I >would like to do is write a perl script that can run a complete directory >listing including sub-directories and save the

Re: Directory Listing

2004-04-21 Thread David Dorward
On 21 Apr 2004, at 11:09, Ryan Thomas wrote: I am relatively new at PERL and am learning it for a school project. What I would like to do is write a perl script that can run a complete directory listing including sub-directories and save the result to a text file. Not sure where to start

Directory Listing

2004-04-21 Thread Ryan Thomas
I am relatively new at PERL and am learning it for a school project. What I would like to do is write a perl script that can run a complete directory listing including sub-directories and save the result to a text file. Not sure where to start. Help!! thanks Jane

RE: problem with directory listing

2002-04-11 Thread Jason Larson
> -Original Message- > From: richard noel fell [mailto:[EMAIL PROTECTED]] > Subject: problem with directory listing > > Below is sample code that does not work as I intend, the > intention being > to list all the sub-directories in a given directory. > > #!/u

Re: problem with directory listing

2002-04-11 Thread richard noel fell
richard noel fell'; [EMAIL PROTECTED] > Subject: RE: problem with directory listing > > Whitespace, whitespace, whitespace. Right, got that over with now let's look > at your code (formatted so it's readable) > > #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w &g

RE: problem with directory listing

2002-04-11 Thread John Edwards
Sorry. That should have been prepend. -Original Message- From: John Edwards [mailto:[EMAIL PROTECTED]] Sent: 11 April 2002 12:47 To: 'richard noel fell'; [EMAIL PROTECTED] Subject: RE: problem with directory listing Whitespace, whitespace, whitespace. Right, got that ove

RE: problem with directory listing

2002-04-11 Thread John Edwards
ir_to_process \n"; } } closedir DH; HTH John -Original Message- From: richard noel fell [mailto:[EMAIL PROTECTED]] Sent: 11 April 2002 13:07 To: [EMAIL PROTECTED] Subject: problem with directory listing Below is sample code that does not work as I intend, the intention being to

problem with directory listing

2002-04-11 Thread richard noel fell
Below is sample code that does not work as I intend, the intention being to list all the sub-directories in a given directory. #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w use strict; my $mw; my $menubar; my $algebra; my @file_array; my $dir_to_process = "/home/rfell/mathprogram"; opendir DH, $

RE: directory listing to array

2001-06-08 Thread Richard Hulse
Thanks folks, this is ANOTHER module I'm going to start using. I have to say that this is a lot more fun than counting clock cycles, which was the last bench-marking I did a long, long time ago... regards, Richard At 19:53 7/06/2001 -0700, Peter Cornelius wrote: >Looking at the other postin

Re: directory listing to array

2001-06-07 Thread Richard Hulse
Since someone raised the general question of differences, which is faster? Randal's suggestion: my @result = <*.jpg>; or variations on: @files = grep /jpg/i, readdir DIR; regards, Richard

Re: directory listing to array

2001-06-07 Thread iansmith
On 7 Jun 2001, Randal L. Schwartz wrote: > Was this on 5.6 or 5.6.1, where the glob is internalized, or on 5.5 or > earlier, where glob called an external process? This is on a RedHat Linux 7.1 os with 5.6.0. -- Ian

RE: directory listing to array

2001-06-07 Thread Peter Cornelius
> I got > > Benchmark: timing 5 iterations of Randals, variations... >Randals: 79 wallclock secs (28.94 usr + 49.99 sys = 78.93 > CPU) @ 633.46/s > (n=5) > variations: 0 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU) @ > 166.67/s (n=5) > (warning: too few it

Re: directory listing to array

2001-06-07 Thread Randal L. Schwartz
> "iansmith" == iansmith <[EMAIL PROTECTED]> writes: iansmith> On Fri, 8 Jun 2001, Richard Hulse wrote: >> Since someone raised the general question of differences, which is faster? >> my @result = <*.jpg>; >> or variations on: >> @files = grep /jpg/i, readdir DIR; iansmith> use Benchmark;

RE: directory listing to array

2001-06-07 Thread Peter Cornelius
> which is faster? > > Randal's suggestion: > > my @result = <*.jpg>; > > or variations on: > > @files = grep /jpg/i, readdir DIR; > Try this... use Benchmark; opendir (DH, ".") or die; timethese(5, { 'Randals' => q{my @result = <*.jpg>}, 'variations' => q{my @result =

Re: directory listing to array

2001-06-07 Thread iansmith
On Fri, 8 Jun 2001, Richard Hulse wrote: > Since someone raised the general question of differences, which is faster? > my @result = <*.jpg>; > or variations on: > @files = grep /jpg/i, readdir DIR; use Benchmark; timethese(1, { 'Glob' => sub { my @result = <*.jpg>; }, 'Read' => sub { opendir

RE: directory listing to array

2001-06-07 Thread Peter Cornelius
Looking at the other posting to this I realize I should have included the open and close in the test block. That makes the results... Benchmark: timing 1 iterations of Randals, variations... Randals: 16 wallclock secs ( 6.00 usr + 10.05 sys = 16.05 CPU) @ 622.98/s (n=1) variations: 3 w

RE: directory listing to array

2001-06-07 Thread iansmith
On Thu, 7 Jun 2001, Peter Cornelius wrote: > use Benchmark; > opendir (DH, ".") or die; > timethese(5, { > 'Randals' => q{my @result = <*.jpg>}, > 'variations' => q{my @result = grep /\.jpg$/i, readdir DH} > }); > closedir(DH) This only reads the directory in once for the 'variati

Re: directory listing to array

2001-06-07 Thread Peter Scott
At 01:45 PM 6/7/01 -0500, Shawn wrote: >Can someone let me know what effectively is the difference between >@files = grep {/jpe?g$/i} readdir DIR; >and >@files = grep /jpe?g$/i, readdir DIR; >? > >Or is there any? There isn't. Some people like to use only the block form even in those cases wher

Re: directory listing to array

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Shawn said: >Japhy pointed out this particular syntax to me. Before this, I was using >@files = grep {/jpe?g$/i} readdir DIR; > >Can someone let me know what effectively is the difference between >@files = grep {/jpe?g$/i} readdir DIR; >and >@files = grep /jpe?g$/i, readdir DIR; If you

Re: directory listing to array

2001-06-07 Thread Shawn
Japhy pointed out this particular syntax to me. Before this, I was using @files = grep {/jpe?g$/i} readdir DIR; Can someone let me know what effectively is the difference between @files = grep {/jpe?g$/i} readdir DIR; and @files = grep /jpe?g$/i, readdir DIR; ? Or is there any? On 06/07, Pete E

Re: directory listing to array

2001-06-07 Thread Pete Emerson
...and just to include both .jpg and .jpeg like John's program: opendir DIR, "./" or die "can't open $directory: $!\n"; @files = grep /jpe?g$/i, readdir DIR; Nice code, Shawn. I must admit that my original way of doing this was even worse than John's (by not using opendir and closedir). Zoiks. G

Re: directory listing to array

2001-06-07 Thread Shawn
R); > return(@jpeg); > } #end get_jpg_from_dir > > --- > [EMAIL PROTECTED] (Galactic Hero) > Diplomacy: The art of saying good doggie > while searching for a big rock. > > > -Original Message- > > From: Evan McNabb [mailto:[EMAIL PROTECTED]] &g

Re: directory listing to array

2001-06-07 Thread Evan McNabb
Thanks for the info, I got everything up and running. I've never had so many responses in such a short amount of time, and with so many ways of getting the job done... :-) -Evan Evan McNabb [EMAIL PROTECTED] http://www.mcnabbs.org/evan

Re: directory listing to array

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 11:16:36AM -0500, Evan McNabb wrote: > > I've been working on a little script for a while but I can't seem to get > this part working. What I want to do is list all of the *.jpg files in a > directory (ls *.jpg) and then have an array with each filename as elements > of th

RE: directory listing to array

2001-06-07 Thread John Storms
while closedir(DIR); return(@jpeg); } #end get_jpg_from_dir --- [EMAIL PROTECTED] (Galactic Hero) Diplomacy: The art of saying good doggie while searching for a big rock. > -Original Message- > From: Evan McNabb [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 07,

RE: directory listing to array

2001-06-07 Thread Andrew Nelson
EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 12:17 PM To: [EMAIL PROTECTED] Subject: directory listing to array I've been working on a little script for a while but I can't seem to get this part working. What I want to do is list all of the *.jpg files in a directory (ls *.jpg) an

Re: directory listing to array

2001-06-07 Thread Jean-Matthieu Guerin
@list = `ls *.jpg`; print @list; Evan McNabb wrote: > > I've been working on a little script for a while but I can't seem to get > this part working. What I want to do is list all of the *.jpg files in a > directory (ls *.jpg) and then have an array with each filename as elements > of that arr

Re: directory listing to array

2001-06-07 Thread Paul
--- Evan McNabb <[EMAIL PROTECTED]> wrote: > I've been working on a little script for a while but I can't seem to > get this part working. What I want to do is list all of the *.jpg > files in a directory (ls *.jpg) and then have an array with each > filename as elements of that array. Its probab

Re: directory listing to array

2001-06-07 Thread Randal L. Schwartz
> "Evan" == Evan McNabb <[EMAIL PROTECTED]> writes: Evan> I've been working on a little script for a while but I can't seem to get Evan> this part working. What I want to do is list all of the *.jpg files in a Evan> directory (ls *.jpg) and then have an array with each filename as elements Ev

directory listing to array

2001-06-07 Thread Evan McNabb
I've been working on a little script for a while but I can't seem to get this part working. What I want to do is list all of the *.jpg files in a directory (ls *.jpg) and then have an array with each filename as elements of that array. Its probably easy but I just can't get it right yet... :-)