find command

J

julia

This command doesn't seem to be correct.

find \&lsRuleFiles, "$rulesPath";

Does someone can give me examples of the right syntax to use find command ?
 
F

Fabian Pilkowski

* julia said:
This command doesn't seem to be correct.

find \&lsRuleFiles, "$rulesPath";

To me, this seems to be a simple call to File::Find's find-method. And
if that agrees to your code (search for the string "use File::Find") I
cannot see any problem with the one line above (except the needless
quotes about $rulesPath).
Does someone can give me examples of the right syntax to use find
command ?

Have you already read the docs, e.g. at

http://search.cpan.org/~nwclark/perl-5.8.6/lib/File/Find.pm

? Perhaps you'll consider to show us some more lines of your code, and
explain what your code shall do.

regards,
fabian
 
J

jl_post

julia said:
This command doesn't seem to be correct.

find \&lsRuleFiles, "$rulesPath";

Does someone can give me examples of the right
syntax to use find command ?


That looks correct to me -- providing you're using the find()
function from the File::Find module. I'll even include that exact line
in a small Perl script to demontrate that it is correct.

All this Perl script does is print out the names of all files and
directories found inside '.' (the current directory):


#!/usr/bin/perl
use strict;
use warnings;

use File::Find;

sub lsRuleFiles
{
print "Found $File::Find::name\n";
}

my $rulesPath = '.'; # the current directory

find \&lsRuleFiles, "$rulesPath";

__END__


So the line of code you provided works perfectly as is. If you
still have a problem, you'll have to provide us with a small program
that we can run to reproduce your exact problem. Once we can reproduce
your problem and see the exact error message(s) that you see, then we
can figure out what needs correcting.

I hope this helps, Julia.

-- Jean-Luc Romano
 
H

Henry Law

This command doesn't seem to be correct.

find \&lsRuleFiles, "$rulesPath";

Does someone can give me examples of the right syntax to use find command ?

perldoc file::find

NAME
File::Find - Traverse a directory tree.

SYNOPSIS
use File::Find;
find(\&wanted, @directories_to_search);
sub wanted { ... }

If that's not enough then you'll have to follow the posting
guidelines: create a small complete program that shows your problem
and post it, saying what behaviour you expected and what actually
happened.
 
T

Tad McClellan

julia said:
This command doesn't seem to be correct.
^^^^^^^^^^^^


What did you observe that led you to belive that?

You should provide one or more symptoms if you hope for a diagnosis.

find \&lsRuleFiles, "$rulesPath";

Does someone can give me examples of the right syntax to use find command ?


The above _is_ the right syntax to use the find command
(apart from the useless use of quotes, don't do that)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top