Re: command-line commands within a Perl script

2002-05-25 Thread drieux
On Friday, May 24, 2002, at 07:42 , Torres, Jose wrote: > Here's the code I currently have to do this: > > $startDir = $ARGV[0]; > > ## Main Program ## > $dir = (); > opendir (DIR, $startDir); > foreach $dir (readdir(DIR)) { > if(($dir ne ".") && ($dir ne "..")){ > CreateChec

RE: command-line commands within a Perl script

2002-05-24 Thread Torres, Jose
Here's the code I currently have to do this: $startDir = $ARGV[0]; ## Main Program ## $dir = (); opendir (DIR, $startDir); foreach $dir (readdir(DIR)) { if(($dir ne ".") && ($dir ne "..")){ CreateChecksum($dir); } } closedir DIR; sub CreateChecksum { my($

Re: command-line commands within a Perl script

2002-05-23 Thread drieux
On Thursday, May 23, 2002, at 01:45 , Torres, Jose wrote: > what Perl function can I used to invoke something usually done at the > command line? > I want to execute: > > sum * > SNP/020405/foo.txt > > this will call checksum on everything and output to foo.txt in > /SNP/020405. > Problem is, t

Re: command-line commands within a Perl script

2002-05-23 Thread John W. Krahn
"John W. Krahn" wrote: > > This should give you some ideas on how to do it > > use warnings; > use strict; > use File::Find; > > my %files; > find( sub { > # put all .doc files in the hash > push @{$files{$File::Find::dir}}, $File::Find::name if /\.doc$/i > # get the directory name

Re: command-line commands within a Perl script

2002-05-23 Thread John W. Krahn
Jose Torres wrote: > > Hi, Hello, > I have a directory with several subdirectories, each full of several dozen > Word files. For each subdirectory, I need to run the checksum app against > all of that directory's files and output a file into that directory with the > checksum results. How can

RE: command-line commands within a Perl script

2002-05-23 Thread Torres, Jose
what Perl function can I used to invoke something usually done at the command line? I want to execute: sum * > SNP/020405/foo.txt this will call checksum on everything and output to foo.txt in /SNP/020405. Problem is, the * will sum all files in the current directory, not those in SNP/020405. So

RE: command-line commands within a Perl script

2002-05-23 Thread Shishir K. Singh
Whoa!! Perl was not meant to make you work so hard!! For changing directory...used function chdir (perldoc -f chdir) For getting teh directories...well opendir (DIR,"$myCurDir"); foreach (readir(DIR)) { if (-d $_) { Change to the directory } } Probably you an use recursion t

RE: command-line commands within a Perl script

2002-05-23 Thread Torres, Jose
Thanks everyone for your help. It is much appreciated. -Original Message- From: David vd Geer Inhuur tbv IPlib [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 23, 2002 12:39 PM To: [EMAIL PROTECTED]; Torres, Jose Subject: Re: command-line commands within a Perl script Hi, A possible

Re: command-line commands within a Perl script

2002-05-23 Thread David vd Geer Inhuur tbv IPlib
Hi, A possible way : #--- use File::Find; use File::stat; my $directory = "/user/IPlib/IPlib/"; find(\&search, $directory); } sub search() { my $file = $File::Find::name || shift; if ( -d $file ) { push @dirs,$file; } else { push @files,$file; } print @files; print @dir

RE: command-line commands within a Perl script

2002-05-23 Thread Timothy Johnson
If you do that, you will be invoking the shell, changing the current directory for the shell, and then closing the shell. What you want is to use the chdir() Perl function to change the current directory of your Perl script. perldoc -f chdir -Original Message- From: Torres, Jose To: