Re: File::Find .. still confused slightly

2017-07-05 Thread Harry Putnam
rea...@newsguy.com (Harry Putnam) writes: > What surprised me is the that when I ran them prefaced with the `time' > utility, I see the sloppy mess I wrote is nearly twice as fast. I may have found a reason. in the find sub {} part you did two returns return unless -f; return un

Re: File::Find .. still confused slightly

2017-07-05 Thread Harry Putnam
t your logic depends upon detecting when the > directory name changes, and will therefore not work on the last file > encountered. It also depends upon all of the files in a directory > being scanned sequentially. While that seems to work, it is not > guaranteed by File::Find. > > A sim

Re: File::Find .. still confused slightly

2017-07-05 Thread Jim Gibson
, and will therefore not work on the last file encountered. It also depends upon all of the files in a directory being scanned sequentially. While that seems to work, it is not guaranteed by File::Find. A simpler method for counting files in each directory would be to use a hash with the

File::Find .. still confused slightly

2017-07-05 Thread Harry Putnam
Working on script using File::Find to count the number of news posts in a semi-extensive hierarchy. As some may know, news posts are commonly stored in numeric named files, one file per posting. The following script tries to plow thru a hierarchy returning the directory name and file count for

Re: File::Find report file count per directory

2017-06-28 Thread Harry Putnam
{ return unless /\A\d+\z/; $oacnt++; if ($data{$File::Find::dir}++ == 0 ) { if ($cnt) { printf "%-17s %d\n",$d, $cnt; } $cnt = 0; } $d = $File::Find::dir; $cnt ++; }, $dir;

Re: File::Find report file count per directory

2017-06-28 Thread Harry Putnam
{ return unless /\A\d+\z/; $oacnt++; if ($data{$File::Find::dir}++ == 0 ) { if ($cnt) { printf "%-17s %d\n",$d, $cnt; } $cnt = 0; } $d = $File::Find::dir; $cnt ++; }, $dir;

Re: File::Find report file count per directory

2017-06-28 Thread Jim Gibson
; > I know that all the information I want to extract is available in > File::Find. > > Just having trouble seeing how to get at it when I want it. > > Connecting the directory name with the file count is the rub for me. > > I googled extensively but have not found thi

File::Find report file count per directory

2017-06-28 Thread Harry Putnam
1) I want to count numeric named files in each directory. 2) I want to capture the name of the directory those files are in 3) I want to print the directory name and the count (if any) for each directory. I know that all the information I want to extract is available in File::Find. Just

Re: Confused with File::Find

2017-06-25 Thread Harry Putnam
and...@geekuni.com (Andrew Solomon) writes: [...] > The way it works it that `find` is traversing through the directories and > `$File::Find::dir` is the directory it's *in* when it calls your subroutine > on `$File::Find::name` which is inside that directory. When it was sittin

Re: Confused with File::Find

2017-06-24 Thread Andrew Solomon
Here's a small tweak to your initial script which goes some way toward shedding light on what was going wrong: #!/usr/bin/env perl use strict; use warnings; use File::Find; use feature 'say'; my $d = './one'; find sub { return if -f; say $File::Find::name;

Re: Confused with File::Find

2017-06-24 Thread Harry Putnam
shlo...@shlomifish.org (Shlomi Fish) writes: > $File::Find::dir is the containing directory of the path item (= the > dirname in http://perldoc.perl.org/File/Basename.html ). Finally, > note that File::Find has OK, I guess I follow that. As you see in my reply to Andrew S, I kind of f

Re: Confused with File::Find

2017-06-24 Thread Harry Putnam
erstand what is happening. >> find sub { >> return if -f; >> print "\$File::Find::dir<$File::Find::dir>\n"; >> }, $d; Seemed to me, would do that. Skip -f type files and print all directory names. Instead I see: >> Output: >>

Re: Confused with File::Find

2017-06-24 Thread Shlomi Fish
Hi Harry! On Fri, 23 Jun 2017 16:56:13 -0400 Harry Putnam wrote: > Trying for a better understand of using File::Find, butI'm missing > something pretty basic I think > > First: The directory structure in this test: > > ./one/tst.pl > two/tst.pl > three/

Re: Confused with File::Find

2017-06-24 Thread Andrew Solomon
Hi Harry What do you want your code to do? Andrew On Fri, Jun 23, 2017 at 9:56 PM, Harry Putnam wrote: > Trying for a better understand of using File::Find, butI'm missing > something pretty basic I think > > First: The directory structure in this test: > > ./one/

Confused with File::Find

2017-06-23 Thread Harry Putnam
Trying for a better understand of using File::Find, butI'm missing something pretty basic I think First: The directory structure in this test: ./one/tst.pl two/tst.pl three/tst.pl So each directory in the layering has the same type -f file in it. Or ls -R ./one ./one: t

Re: File:: Find help

2013-01-10 Thread punit jain
I think the issue is as you mentioned exporting find from File::Find::Rule. However File::Find I am not sure I will get that flexibility to search only 1 level depth. On Thu, Jan 10, 2013 at 6:07 PM, David Precious wrote: > On Thu, 10 Jan 2013 17:56:18 +0530 > punit jain wrote: > &

Re: File:: Find help

2013-01-10 Thread John W. Krahn
ome processing. That is easy enough to do: for my $file ( ) { open my $FH, '<', $file or die "Cannot open '$file' because: $!"; # process $file contents here } I wrote code below :- #!/usr/bin/perl use strict; use warnings; use File::Basename qw(

Re: File:: Find help

2013-01-10 Thread David Precious
e qw(basename dirname); > use File::Find qw(find); > use File::Find::Rule; [...] > find( sub { > print $File::Find::name; > if ($File::Find::name =~ /Contacts/ && -s > $File::Find::name > 0 ) { > print

File:: Find help

2013-01-10 Thread punit jain
low :- #!/usr/bin/perl use strict; use warnings; use File::Basename qw(basename dirname); use File::Find qw(find); use File::Find::Rule; my $indir = shift; my $Users = {}; my @userdirs=File::Find::Rule->maxdepth(1)->directory->in($indir); # this will give me user directories which I want onl

File::Find help

2013-01-10 Thread punit jain
Hi, I have a requirement where I have directory structure like : - test --> test/user1/files, test/user2/files, test/user3/files etc. under sub-directories with usernames I have file with name usersettings. So the final structure as : - test / user1 / usersettings user2 / usersettings

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
gt; $VAR1 = 1; > > > > > > > > The start method is a method that doesn't return anything > > > > important, but manipulates things for other methods to use. What > > > > you want to do instead is set up the rules for $plf and then call > > >

Re: File::Find::Object::Rule problem

2012-04-23 Thread Manfred Lotz
method > separately: > I see. In meantime Shlomi adjusted the code to the documetation which makes it very convenient to work with the package. > use strict; > use warnings; > > use Data::Dumper; > > use File::Find::Object::Rule ; > > my $plf = File::

Re: File::Find::Object::Rule problem

2012-04-23 Thread Manfred Lotz
int Dumper($plf) . "\n"; > > > > > > returns > > > > > > $VAR1 = 1; > > > > > > The start method is a method that doesn't return anything > > > important, but manipulates things for other methods to use. What > > >

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
turn anything important, but > > manipulates things for other methods to use. What you want to do instead > > is set up the rules for $plf and then call the start method separately: > > > > use strict; > > use warnings; > > > > use Data::Dumper; >

Re: File::Find::Object::Rule problem

2012-04-23 Thread Shlomi Fish
e start method separately: > > use strict; > use warnings; > > use Data::Dumper; > > use File::Find::Object::Rule ; > > my $plf = File::Find::Object::Rule->file->name("*.pl"); > $plf->start("./"); > > while ( my $perl_fil

RE: File::Find::Object::Rule problem

2012-04-22 Thread Jack Maney
27;t return anything important, but manipulates things for other methods to use. What you want to do instead is set up the rules for $plf and then call the start method separately: use strict; use warnings; use Data::Dumper; use File::Find::Object::Rule ; my $plf = File::Find::Object::Rule->f

File::Find::Object::Rule problem

2012-04-22 Thread Manfred Lotz
Hi, I'm trying out File::Find::Object::Rule and get a problem. Here a minimal example: #! /usr/bin/perl use strict; use warnings; use Data::Dumper; use File::Find::Object::Rule ; my $plf = File::Find::Object::Rule->file->name("*.pl")->start( "./" ); w

Re: File::Find script questions

2011-07-19 Thread Uri Guttman
Sender => 'u...@z.com', Subject => 'foo bar', } ) ; my $foo_text = join '', map "$_\n", @new_foos ; print $mailer $foo_text ; $mailer->close() ; M> find(\&wanted, $path_to_search);

Re: File::Find script questions

2011-07-19 Thread Marc
modules and there seems to be a million of them. Could you recommend a couple that you like? Thanks again, Marc -- #!/usr/bin/perl use strict; use warnings; use File::Find; use File::Slurp; my $path_to_search = $ENV{HOME}.'/public_html'; my $file_name = '

Re: File::Find script questions

2011-07-18 Thread Uri Guttman
without it, but it seems like I should be able M>to. =:\ M> use strict; M> use warnings; good. M> use File::Find; M> use File::HomeDir; M> find(\&wanted, $path_to_search); M> sub wanted { M>if ($File::Find::name =~ /$file_name/) { it wo

Re: File::Find script questions

2011-07-18 Thread Uri Guttman
> "HW" == Hal Wigoda writes: HW> Why clean it up when it works and is not obfusticating. because he asked for comments and it will be educational to all on the list. uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- Perl Developer Recruit

Re: File::Find script questions

2011-07-18 Thread John W. Krahn
e welcome. Also, do I really need the foreach block in there? I couldn't get it to work without it, but it seems like I should be able to. =:\ Thanks, Marc #!/usr/bin/perl use strict; use warnings; use File::Find; use File::HomeDir; my $path_to_search

Re: File::Find script questions

2011-07-18 Thread Hal Wigoda
ems like I should be able to. =:\ > > Thanks, > Marc > > ---- > > #!/usr/bin/perl > > use strict; > use warnings; > > use File::Find; > use File::HomeDir; > > my $path_to_search = File::HomeDir->my_home.'/public_html'; > my $file_name

File::Find script questions

2011-07-18 Thread Marc
comments are welcome. Also, do I really need the foreach block in there? I couldn't get it to work without it, but it seems like I should be able to. =:\ Thanks, Marc #!/usr/bin/perl use strict; use warnings; use File::Find; use File::HomeDir;

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Shawn H Corey
On 11-04-20 06:55 AM, Agnello George wrote: Thanks a lot , but was just wondering if i could ignore it in the File::Find function Yup. my @all = qw( /classes/mail.class.php classes/dealer.class.php classes/memcache.class.php classes/phpmailer classes/phpmailer/.htaccess classes/phpmailer

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Agnello George
On Wed, Apr 20, 2011 at 4:34 PM, Shlomi Fish wrote: > Hi Agnello, > > On Wednesday 20 Apr 2011 13:59:24 Agnello George wrote: >> On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish wrote: >> > On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote: >> > >> > You can remove the ./: >> > >> > [CODE] >> >

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Shlomi Fish
Hi Agnello, On Wednesday 20 Apr 2011 13:59:24 Agnello George wrote: > On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish wrote: > > On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote: > > > > You can remove the ./: > > > > [CODE] > > foreach my $filename (@all) > > { > >my $fn_wo_prefix =

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Agnello George
On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish wrote: > On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote: >> Hi >> >> I have script where i need to  go in to a directory and put all files >> in to a array >> >> if ( chdir ("$dirtemp")

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Agnello George
On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish wrote: > On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote: >> Hi >> >> I have script where i need to  go in to a directory and put all files >> in to a array >> >> if ( chdir ("$dirtemp")

Re: unable to remove the ./ when using File::Find::name

2011-04-20 Thread Shlomi Fish
On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote: > Hi > > I have script where i need to go in to a directory and put all files > in to a array > > if ( chdir ("$dirtemp") ) { > find (sub { push @all , $File::Find::name}, "."); > >

unable to remove the ./ when using File::Find::name

2011-04-20 Thread Agnello George
Hi I have script where i need to go in to a directory and put all files in to a array if ( chdir ("$dirtemp") ) { find (sub { push @all , $File::Find::name}, "."); my %selectfiles = qw( /classes/mail.class.php classes/dealer.class.php classes/memcache.class.php class

Re: File::Find usage

2010-07-24 Thread John W. Krahn
Unknown User wrote: I have this script to find out where a perl module is on my machine: [unkn...@knowme:~/bin]$ cat findmodule #!/usr/bin/perl -w use File::Find; use strict; if ($ENV{"INC"} ) { # INC=PATH1:PATH2 ./getmodule perldoc perlrun [ SNIP ] PERL5LIB

File::Find usage

2010-07-23 Thread Unknown User
I have this script to find out where a perl module is on my machine: [unkn...@knowme:~/bin]$ cat findmodule #!/usr/bin/perl -w use File::Find; use strict; if ($ENV{"INC"} ) { # INC=PATH1:PATH2 ./getmodule ... for my $toadd (split(/:/

Re: File::Find and top level directory

2010-04-25 Thread Shlomi Fish
On Saturday 24 Apr 2010 22:00:56 Harry Putnam wrote: > When using File::Find; > Is there any built in way to know when you are in the top level of one > of the directories in @directories? > > I mean besides grepping $File::Find::dir. > > I know that give the current directo

File::Find and top level directory

2010-04-24 Thread Harry Putnam
When using File::Find; Is there any built in way to know when you are in the top level of one of the directories in @directories? I mean besides grepping $File::Find::dir. I know that give the current directory name and of course the top directory could be massages out with something like

Re: good practice in File::Find

2010-03-09 Thread Harry Putnam
Harry Putnam writes: >> Or perhaps: >> >> return if $File::Find::dir !~ /$dir_rgx/; >> > > Thanks. > >>> or >>> Like I've done in he code below. Just let the dir_rgx be a selector >>> and not worry about pulling the next line i

Re: good practice in File::Find

2010-03-08 Thread Harry Putnam
"John W. Krahn" writes: >> Like: next if(! $File::Find::dir =~ /$dir_rgx/); > > No. Because you are inside a subroutine you have to use return: > > return unless $File::Find::dir =~ /$dir_rgx/; > > Or perhaps: > > return if $File::Find::dir !~ /$

Re: good practice in File::Find

2010-03-08 Thread John W. Krahn
he text_regex that might be in the files there. The idea being to allow you to focus a search without having to know the exact name of the newsgroup[s]. You would at least be searching a group with the string `linux.' in it. So what I'm curious about is if it would be good to `next'

Re: good practice in File::Find

2010-03-08 Thread Shawn H Corey
Harry Putnam wrote: > find( > sub { > ## if we have a directory name that matches > if($File::Find::dir =~ /$dir_rgx/){ > ## if that directory has files with all numeric names > if(/^\d+$/){ if( ! /\D/ ){ > ## Open the files and

Re: good practice in File::Find

2010-03-08 Thread Harry Putnam
Harry Putnam writes: > [...] > > find( > sub { > ## if we have a directory name that matches > if($File::Find::dir =~ /$dir_rgx/){ > ## if that directory has files with all numeric names > if(/^\d+$/){ > ## Open the file

good practice in File::Find

2010-03-08 Thread Harry Putnam
ht be in the files there. The idea being to allow you to focus a search without having to know the exact name of the newsgroup[s]. You would at least be searching a group with the string `linux.' in it. So what I'm curious about is if it would be good to `next' out if the File::Find

Re: File::Find NO RECURSION Howto

2010-03-03 Thread Shlomi Fish
On Monday 01 Mar 2010 19:31:15 Shawn H Corey wrote: > Shlomi Fish wrote: > > Well, Matt S. Trout shared his sentiments about "I cannot use CPAN" here: > > > > http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/ > > Well, Matt is wrong. You can't always use CPAN. Yes, you can set i

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shawn H Corey
Shlomi Fish wrote: > Well, Matt S. Trout shared his sentiments about "I cannot use CPAN" here: > > http://www.shadowcat.co.uk/blog/matt-s-trout/but-i-cant-use-cpan/ > Well, Matt is wrong. You can't always use CPAN. Yes, you can set it up so you can use it in development, but that doesn't mean

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shlomi Fish
On Monday 01 Mar 2010 15:00:26 raphael() wrote: > On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey wrote: > > raphael() wrote: > > > Hi, > > > > > > How can I stop File::Find to go below current dir? i.e. no recursion. > > > > > > Although

Re: File::Find NO RECURSION Howto

2010-03-01 Thread raphael()
On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey wrote: > raphael() wrote: > > Hi, > > > > How can I stop File::Find to go below current dir? i.e. no recursion. > > > > Although I can use glob or <*> to get file names in current dir. > > But I wanted to

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shlomi Fish
On Monday 01 Mar 2010 13:23:16 raphael() wrote: > Hi, > > How can I stop File::Find to go below current dir? i.e. no recursion. > > Although I can use glob or <*> to get file names in current dir. > But I wanted to know if File::Find has a maxdepth limit like linux &q

Re: File::Find NO RECURSION Howto

2010-03-01 Thread Shawn H Corey
raphael() wrote: > Hi, > > How can I stop File::Find to go below current dir? i.e. no recursion. > > Although I can use glob or <*> to get file names in current dir. > But I wanted to know if File::Find has a maxdepth limit like linux "find". > > The scri

File::Find NO RECURSION Howto

2010-03-01 Thread raphael()
Hi, How can I stop File::Find to go below current dir? i.e. no recursion. Although I can use glob or <*> to get file names in current dir. But I wanted to know if File::Find has a maxdepth limit like linux "find". The script I created uses a switch which decides if recursion i

Re: need some help excluding with file::find::rule

2010-01-22 Thread John W. Krahn
solaristar wrote: First please forgive me if this is the wrong way to go about asking this question. I already answered this question on comp.lang.perl.misc. Do you want me to answer it again here? John -- The programmer is fighting against the two most destructive forces in the universe:

need some help excluding with file::find::rule

2010-01-22 Thread solaristar
dont have the afore mentioned criteria, any feedback is appreciated #!/usr/bin/perl use strict; use warnings; use File::Find::Rule; use File::Basename qw/basename dirname/; my @data_dir = qw { /data/backups };# list here the data dir if you want to loop on it. foreach my $dir (@data_d

Re: About internal working of File::Find

2009-10-28 Thread Harry Putnam
Jim Gibson writes: [...] > See 'perldoc perllol' for more details on constructing and accessing nested > data structures in Perl. Will do, and as always you've given a useful and brief run through, thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-m

Re: About internal working of File::Find

2009-10-28 Thread Jim Gibson
or example, if you want to process files in chronological order, in >> the wanted routine save the file path and age as an array entry (untested): >> >> my @files; >> my $dir = '/some/directory/path'; >> >> find( sub{ >>

Re: About internal working of File::Find

2009-10-28 Thread Harry Putnam
ile path and age as an array entry (untested): > > my @files; > my $dir = '/some/directory/path'; > > find( sub{ > my $age = -M $File::Find::name; > push( @files, [ $File::Find::name, $age ] ); > }, $dir); > >

Re: About internal working of File::Find

2009-10-28 Thread Jim Gibson
On 10/28/09 Wed Oct 28, 2009 12:55 PM, "Harry Putnam" scribbled: > Looking over the perldoc File::Find output (perl 5.8.4) > > I see at finddepth it says: > [...] in part > >"finddepth()" works just like "find()" except that is invok

About internal working of File::Find

2009-10-28 Thread Harry Putnam
Looking over the perldoc File::Find output (perl 5.8.4) I see at finddepth it says: [...] in part "finddepth()" works just like "find()" except that is invokes the &wanted function for a directory after invoking it for the direc- tory's c

Re: File::Find with chmod trouble debugging

2009-07-08 Thread Harry Putnam
Telemachus writes: > On Mon Jul 06 2009 @ 3:31, Harry Putnam wrote: >> Thanks to all ... >> Now I'm curious about something else: >> >> Is the mode in a stat(file) readout something still different >> than octal or decimal? > > As John answered, there's more there than just the permissions. If

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Telemachus
On Mon Jul 06 2009 @ 3:31, Harry Putnam wrote: > Thanks to all ... > Now I'm curious about something else: > > Is the mode in a stat(file) readout something still different > than octal or decimal? As John answered, there's more there than just the permissions. If you check perldoc -f stat, ther

Re: File::Find with chmod trouble debugging

2009-07-06 Thread John W. Krahn
Harry Putnam wrote: Thanks to all ... Now I'm curious about something else: Is the mode in a stat(file) readout something still different than octal or decimal? I see `33261' show up in the `mode' slot on a file with 755 permissions (from perldoc -f stat: [...] ($dev,$ino,$mode,$nli

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Harry Putnam
Thanks to all ... Now I'm curious about something else: Is the mode in a stat(file) readout something still different than octal or decimal? I see `33261' show up in the `mode' slot on a file with 755 permissions (from perldoc -f stat: [...] ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$si

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Telemachus
On Mon Jul 06 2009 @ 7:00, Harry Putnam wrote: > Can anyone tell me how printing of $mode = 0755 turns into 493? Yup: what's in $mode is an octal number. Its decimal equivalent is 493. What you really want to print out is the string '0755', but the string and the octal number are not the same thi

Re: File::Find with chmod trouble debugging

2009-07-06 Thread Chas. Owens
On Mon, Jul 6, 2009 at 08:00, Harry Putnam wrote: snip > Can anyone tell me how printing of $mode = 0755 turns into 493? snip >  my $mode = 0755; snip >             print "hpdb chmod $mode  $fname\n"; snip 0755 is 493. More specifically they are two representations of the same number: the first i

AW: File::Find with chmod trouble debugging

2009-07-06 Thread Thomas Bätzler
Harry Putnam asked: > The script below is my first usage of perls `chmod', but it appears to > be in keeping with the info at perldoc -f chmod. > > But somehow in the print of $mode it turns into 493... even though it > is set to 755. Its just the print though... the actual chmod appears > to be

File::Find with chmod trouble debugging

2009-07-06 Thread Harry Putnam
Can anyone tell me how printing of $mode = 0755 turns into 493? #!/usr/local/bin/perl use strict; use warnings; use File::Find; my $myscript; ($myscript = $0) =~ s/^.*\///; ## chmod mode my $mode = 0755; if(!...@argv || $ARGV[0] eq "help"){ print &q

Re: File::Find

2009-05-19 Thread Randal L. Schwartz
>>>>> ""Chas" == "Chas Owens" writes: "Chas> Huh, never looked at File::Finder before, it looks like it would only "Chas> make sense if you already knew the UNIX find command. I normally see "Chas> people use File::Find::Rul

Re: File::Find

2009-05-18 Thread Greg Eldridge
> > http://search.cpan.org/~tty/kurila-1.19_0/lib/Benchmark.pm > > -- > Ron Bergin Thanks to all for replying. Greg. signature.asc Description: This is a digitally signed message part

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 21:02, Gunnar Hjalmarsson wrote: > AndrewMcHorney wrote: >> >> I am getting totally confused. All I want is a simple find function call >> what will return all the files that are in c:\*.*. > > File::Find is useful for recursive tasks. If

Re: File::Find

2009-05-18 Thread rkb
Greg Eldridge wrote: > On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote: > > What Benchmark .pm are you using ? > CPAN i/benchmark/ => lists 66 entries, but none of which are simply > Benchmark > > Thanks in advance. > > Greg. > http://search.cpan.org/~tty/kurila-1.19_0/lib/Benchmark.pm

Re: File::Find

2009-05-18 Thread David Moreno
Greg Eldridge wrote: What Benchmark .pm are you using ? CPAN i/benchmark/ => lists 66 entries, but none of which are simply Benchmark Thanks in advance. http://search.cpan.org/~nwclark/perl-5.8.9/lib/Benchmark.pm -- David Moreno http://twitter.com/damog -- To unsubscribe, e-mail: beginne

Re: File::Find

2009-05-18 Thread Greg Eldridge
On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote: > #!/usr/bin/perl > > use strict; > use warnings; > use File::Find; > use Benchmark qw/cmpthese/; > > cmpthese( 10, { > 'dir' => sub {my @files = `dir /b /a-d /s c:\test`

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
AndrewMcHorney wrote: I am getting totally confused. All I want is a simple find function call what will return all the files that are in c:\*.*. File::Find is useful for recursive tasks. If all you want is to list the files in one directory, there are simpler ways. Personally I would use

Re: File::Find

2009-05-18 Thread Chas. Owens
les that are in c:\*.*. This is on PC running >>> windows. I thought you mentioned to use file:find() where one of the >>> parameters would be a function which would be called once for each file >>> found. >> snip >> >> After these two lines run @files will hold e

Re: File::Find

2009-05-18 Thread rkb
ht you mentioned to use file:find() where one of the >> parameters would be a function which would be called once for each file >> found. > snip > > After these two lines run @files will hold every file on the c drive. > > my @files; > find sub { push @files, $File::Find:

Re: File::Find

2009-05-18 Thread David Moreno
AndrewMcHorney wrote: Charles I am getting totally confused. All I want is a simple find function call what will return all the files that are in c:\*.*. This is on PC running windows. I thought you mentioned to use file:find() where one of the parameters would be a function which would be ca

Re: File::Find

2009-05-18 Thread Chas. Owens
here one of the > parameters would be a function which would be called once for each file > found. snip After these two lines run @files will hold every file on the c drive. my @files; find sub { push @files, $File::Find::name if -f }, "c:/"; -- Chas. Owens wonkden.net The most important

Re: File::Find

2009-05-18 Thread AndrewMcHorney
to *the module* File::Find. snip Huh, never looked at File::Finder before, it looks like it would only make sense if you already knew the UNIX find command. I normally see people use File::Find::Rule when they don't want to write their own wanted function. 1. http://search.cpan.org/dist/File-F

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
Chas. Owens wrote: On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson wrote: AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. snip Huh, never looked at File::Finder

Re: File::Find

2009-05-18 Thread Chas. Owens
On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson wrote: > AndrewMcHorney wrote: >> >> I looked at the documentation for this function and I find it confusing. > > Try File::Finder for a less confusing interface to *the module* File::Find. snip Huh, never looked at File::Fi

Re: File::Find

2009-05-18 Thread Gunnar Hjalmarsson
AndrewMcHorney wrote: I looked at the documentation for this function and I find it confusing. Try File::Finder for a less confusing interface to *the module* File::Find. -- Gunnar Hjalmarsson Email: http://www.gunnar.cc/cgi-bin/contact.pl -- To unsubscribe, e-mail: beginners-unsubscr

Re: File::Find

2009-05-18 Thread Chas. Owens
very file and directory on the c drive. An easy way to create function for find is to use an anonymous subroutine: find sub {}, "c:/"; If you want to limit the function to files you can check to see if the current item is a file or not with -f: find sub { return unless -f; print &

File::Find

2009-05-18 Thread AndrewMcHorney
Hello I looked at the documentation for this function and I find it confusing. What do you pass in to get all the files on drive letter c? Andrew -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: Help regarding file find

2009-02-23 Thread Dermot
n the script will create a folder > folder/setup > folder/cleanup > /folder/2.1/setup > /folder/2.1/cleanup > /folder/2.1/2.1.1/setup > /folder/2.1/2.1.1/cleanup > /folder/2.1/2.1.1/2.1.1.1 > /folder/2.1/2.1.1/2.1.1.1/test > /folder/2.2/2.2.1/2.2.1.2/test Most of the

Re: Help regarding file find

2009-02-22 Thread Gunnar Hjalmarsson
Rock Lifestyle wrote: I am new to any programming language .I am trying to copy one file structure. I have a folder structures which contains setup files, cleanup files and test file Now I want to create another file structure where it will copy the directory tree which I have mentioned i

Help regarding file find

2009-02-22 Thread Rock Lifestyle
--- On Sat, 21/2/09, Rock Lifestyle wrote: From: Rock Lifestyle Subject: Help regarding file find To: beginners@perl.org Date: Saturday, 21 February, 2009, 6:30 PM Hi All,   I am new to any programming language .I am trying to copy one file structure.    I have a folder structures

Help regarding file find

2009-02-21 Thread Rock Lifestyle
Hi All,   I am new to any programming language .I am trying to copy one file structure.    I have a folder structures which contains setup files, cleanup files and test file   like /testplan /testplan/setup /testplan/cleanup /testplan/2.1/setup /testplan/2.1/cleanup /testplan/2.1/2.1.1/

Re: file::find skip subdir

2009-01-12 Thread Chas. Owens
On Mon, Jan 12, 2009 at 16:05, icarus wrote: > I'm trying to all count files in a home dir and all subdirs *except* a > subdir called 'backup'. When you run into the condition where you don't want to recurse further, set $File::Find::prune to 1 (e.g. $File::Find::p

file::find skip subdir

2009-01-12 Thread icarus
I'm trying to all count files in a home dir and all subdirs *except* a subdir called 'backup'. How do I that? thanks in advance. #!/usr/bin/perl use warnings; use strict; use File::Find; my $dir = ("/home/foo"); my $counter = 0; find( { wanted => \&proces

Re: ignore directories with File::Find?

2008-10-28 Thread protoplasm
On Oct 24, 12:58 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > > I couldn't get $File::Find::prune to work on my system but this may be > close to what you require: > > #!/usr/bin/perl > use warnings; > use strict; > use File::Find; > > eval "use Fil

Re: ignore directories with File::Find?

2008-10-24 Thread John W. Krahn
overlooking something simple. Here is the code and the output: #!/usr/bin/env perl use File::Find(); eval("use File::HomeDir;"); die "[err] File::HomeDir not installed. Use \"perl -e \"use CPAN; install File::HomeDir;\"\" to install \n" if $@; use strict; use

Re: ignore directories with File::Find?

2008-10-24 Thread protoplasm
ething simple. Here is the code and the output: #!/usr/bin/env perl use File::Find(); eval("use File::HomeDir;"); die "[err] File::HomeDir not installed. Use \"perl -e \"use CPAN; install File::HomeDir;\"\" to install \n" if $@; use strict; use warn

Re: ignore directories with File::Find?

2008-10-23 Thread Telemachus
ignore .svn subfolders, I do this at the start of the subrouting that I hand to File::Find: return $File::Find::prune = 1 if $_ eq '.svn'; HTH, T pgpfaDXPh8cB4.pgp Description: PGP signature

  1   2   3   4   >