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
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
, 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
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
urn 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;
printf
urn 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;
printf
y) for each
> directory.
>
> 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
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
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 sitting
>
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;
say "\$File::Find
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
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:
>>
Hi Harry!
On Fri, 23 Jun 2017 16:56:13 -0400
Harry Putnam <rea...@newsguy.com> 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/
Hi Harry
What do you want your code to do?
Andrew
On Fri, Jun 23, 2017 at 9:56 PM, Harry Putnam <rea...@newsguy.com> 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
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:
tst.pl
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
/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 only to depth 1
(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::name;
# do some
File::Find qw(find);
use File::Find::Rule;
my $indir = shift;
my $Users = {};
Why not just use a hash instead of a reference to a hash?
my @userdirs=File::Find::Rule-maxdepth(1)-directory-in($indir);
# this will give me user directories which I want only to depth 1.
foreach my $dir
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 dav...@preshweb.co.ukwrote:
On Thu, 10 Jan 2013 17:56:18 +0530
punit jain
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-file-name(*.pl);
$plf-start
Data::Dumper;
use File::Find::Object::Rule ;
my $plf = File::Find::Object::Rule-file-name(*.pl);
$plf-start(./);
while ( my $perl_file = $plf-match ){
print $perl_file\n;
}
If you're familiar with DBI, you can think of $plf as a statement handle,
setting up the rules ('-file
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-file-name(*.pl);
$plf-start(./);
while ( my $perl_file = $plf-match ){
print
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
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::Find::Object::Rule-file-name(*.pl);
$plf-start(./);
while ( my $perl_file = $plf-match ){
print $perl_file\n
:
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_file = $plf-match ){
print $perl_file\n;
}
If you're
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( ./ );
while ( my $perl_file = $plf-match
.
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 = 'error_log';
my $from_address = 'f...@me.com';
my $to_address
$foo_text ;
$mailer-close() ;
M find(\wanted, $path_to_search);
M sub wanted {
Mreturn if $_ ne $file_name;
Mmy $subject = substr $File::Find::name, length($path_to_search); #
removes /home/USER/public_html from the subject
bah. that is a very silly way to do that. also
.
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 = File
#!/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 = 'error_log';
my $from_address = 'x...@xxx.com';
my $to_address = 'x...@xxx.com';
my $mail_app
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 = File::HomeDir-my_home
HW == Hal Wigoda hal.wig...@gmail.com 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
be able
Mto. =:\
M use strict;
M use warnings;
good.
M use File::Find;
M use File::HomeDir;
M find(\wanted, $path_to_search);
M sub wanted {
Mif ($File::Find::name =~ /$file_name/) {
it would be much cleaner IMO to collect the paths of the files you want
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
classes/phpmailer
classes
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}, .);
my %selectfiles = qw( /classes/mail.class.php
classes
On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish shlo...@iglu.org.il 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) ) {
find (sub { push @all , $File::Find::name
On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish shlo...@iglu.org.il 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) ) {
find (sub { push @all , $File::Find::name
Hi Agnello,
On Wednesday 20 Apr 2011 13:59:24 Agnello George wrote:
On Wed, Apr 20, 2011 at 4:14 PM, Shlomi Fish shlo...@iglu.org.il wrote:
On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote:
You can remove the ./:
[CODE]
foreach my $filename (@all)
{
my
On Wed, Apr 20, 2011 at 4:34 PM, Shlomi Fish shlo...@iglu.org.il 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 shlo...@iglu.org.il wrote:
On Wednesday 20 Apr 2011 12:50:45 Agnello George wrote:
You can remove the
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
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 ]
PERL5LIBA list
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
module1 module2 module3 ...
for my $toadd (split(/:/,$ENV{INC
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 directory name and of course
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
Harry Putnam rea...@newsguy.com 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 immediately.
I've thought about using `stat' to allow only
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::dir does not contain linux\.
Like:
next
Harry Putnam rea...@newsguy.com 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 files and search
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 search for a regex
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::dir does not contain
John W. Krahn jwkr...@shaw.ca 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 !~ /$dir_rgx/;
Thanks.
or
Like I've done
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 it up
so
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 is allowed
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 script I created uses a switch which decides
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 find.
Not, by itself
On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey shawnhco...@gmail.com 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 know if File::Find has a maxdepth limit
On Monday 01 Mar 2010 15:00:26 raphael() wrote:
On Mon, Mar 1, 2010 at 6:18 PM, Shawn H Corey shawnhco...@gmail.com 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
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 you
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_dir) {
print looking
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:
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 contents. It does a postorder traversal
On 10/28/09 Wed Oct 28, 2009 12:55 PM, Harry Putnam rea...@newsguy.com
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 invokes the
wanted function
the file 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);
for my $entry ( sort { $a-[1] = $b[1] } @files
, 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{
my $age = -M $File::Find::name;
push( @files, [ $File::Find::name, $age
Jim Gibson jimsgib...@gmail.com 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
Telemachus telemac...@arpinum.org 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
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 Usage tripped
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
On Mon, Jul 6, 2009 at 08:00, Harry Putnamrea...@newsguy.com 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
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
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:
[...]
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:
[...]
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, there's
Chas == Chas Owens chas.ow...@gmail.com 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::Rule when they don't want to write their own
Chas wanted function
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/
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::name\n
}, c
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
On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson nore...@gunnar.cc 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 before
Chas. Owens wrote:
On Mon, May 18, 2009 at 19:05, Gunnar Hjalmarsson nore...@gunnar.cc 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
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-Finder/lib/File
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 skill a programmer
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
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::name if -f }, c:/;
--
I like and often recommend using File
:\*.*. 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 every file on the c drive.
my @files;
find sub { push @files, $File::Find::name
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
On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote:
snip
#!/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` },
'filefind' = sub {my @files
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:
Greg Eldridge wrote:
On Mon, 2009-05-18 at 17:36 -0700, r...@i.frys.com wrote:
snip
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
--
On Mon, May 18, 2009 at 21:02, Gunnar Hjalmarsson nore...@gunnar.cc 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 all you want is to list
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
/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 heavy lifting with your requirements can be done with
File::Find and File::Path.
Good luck,
Dp.
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional
--- On Sat, 21/2/09, Rock Lifestyle lifestyle.r...@yahoo.in wrote:
From: Rock Lifestyle lifestyle.r...@yahoo.in
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
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
snip
Now I want to create another file structure where it will copy the
directory tree which I have
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
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 = \process, no_chdir = 0 }, $dir );
sub process
On Mon, Jan 12, 2009 at 16:05, icarus rsa...@gmail.com 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::prune = 1
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 File::HomeDir;;
$@ and die qq{[err] File::HomeDir
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 warnings;
no warnings 'File::Find';
use 5.010;
my $home_directory
be
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 warnings;
no warnings 'File::Find';
use 5.010
Nautilus mounts user shares. How can I find a
particular directory while ignoring hidden folders like .gvfs?
Here is my code.
#!/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
1 - 100 of 360 matches
Mail list logo