Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^3: path-names [a very easy question of a true beginner]

by Khen1950fx (Canon)
on Oct 02, 2010 at 09:58 UTC ( #863059=note: print w/ replies, xml ) Need Help??


in reply to Re^2: path-names [a very easy question of a true beginner]
in thread path-names [a very easy question of a true beginner]

You're using a relative path. I tried it, but I got the same result. Use the absolute path, and it works:).

#!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my @files = File::Find::Rule->file() ->name('*.html') ->in( '/home/usr/perl/html.files' ); foreach my $file(@files) { print $file, "\n"; }


Comment on Re^3: path-names [a very easy question of a true beginner]
Download Code
Replies are listed 'Best First'.
Re^4: path-names [a very easy question of a true beginner]
by Perlbeginner1 (Scribe) on Oct 02, 2010 at 12:49 UTC
    hello dear Khen1950fx

    many many thanks for the quick reply: i am very happy to hear from you! i changed the paths also to absolut -but i did not have the good results here....

    >
    i found out that i made some mistakes while talking bout the html-files: Note: there are more than 20 000 Html files in the directory that is called htmlfiles Note i renamed it to htmlfiles - instead of html.files but the files itself are all named like the following sheme:

    einzelergebnis1...
    einzelergebnis2...
    einzelergebnis3a...
    einzelergebnis3b...
    einzelergebnis3d...

    and so forth...
    so my question is: how is the convention to call it here in this line:

    ->name('*.einzel')

    how to name this line

    -> name('*.einzel')

    or -> name('einzel*.')

    I ask this question - since i guess that perl does not find the files - since i have the wrong naming convention...

    Here the code that might run for you - as you have put some files into the folder - that are named with html*
    #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my @files = File::Find::Rule->file() ->name('*.einzel') ->in( '/home/usr/htmlfiles' ); foreach my $file(@files) { print $file, "\n"; }
    i love to hear from you!
    Btw - if i have to clear my question and ask more precisely - then let me know!

    regards
    perlbeginner1
      Use  ->name('einzelergebnis*'). Like so:
      #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my @files = File::Find::Rule->file() ->name('einzelergebnis*') ->in( '/home/usr/htmlfiles' ); foreach my $file(@files) { print $file, "\n"; }
        hello dear Khen1950fx

        guess that i have some bad luck today. Do i have this done to the wrong directory...!? I cannot start it... i always get the response:

        Results:
        Can't stat /home/usr/perl/htmlfiles: No such file or directory at /usr/lib/perl5/site_perl/5.12.1/File/Find/Rule.pm line 594

        i use

        #!/usr/bin/perl use strict; use warnings; use diagnostics; use File::Find::Rule; my @files = File::Find::Rule->file() ->name('einzelergebnis*.html') ->in( '/home/usr/perl/htmlfiles' ); foreach my $file(@files) { print $file, "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://863059]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (15)
As of 2015-07-31 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls