Home > Archive > PERL Miscellaneous > September 2004 > what module could easiely load all files to a @array from a specified folder(and subf
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
what module could easiely load all files to a @array from a specified folder(and subf
|
|
|
| just tell me the name of module,
my english too poor to can't understand all module help files, forgive
me....
--
Your fault as a Government is My failure as a citizen
| |
| Paul Lalli 2004-09-22, 4:00 pm |
| "Alont" <end@dream.life> wrote in message
news:4151a17b.15044562@130.133.1.4...
> Subject: what module could easiely load all files to a @array from a
specified folder(and subfolders)?
> just tell me the name of module,
> my english too poor to can't understand all module help files, forgive
> me....
File::Find
Paul Lalli
| |
| Randal L. Schwartz 2004-09-22, 4:00 pm |
| *** post for FREE via your newsreader at post.newsfeed.com ***
[color=darkred]
Alont> just tell me the name of module,
Alont> my english too poor to can't understand all module help files, forgive
Alont> me....
use File::Finder; # in CPAN
my @array = File::Finder->type('f')->in($specified_folder);
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
-----= Posted via Newsfeed.Com, Uncensored Usenet News =-----
http://www.newsfeed.com - The #1 Newsgroup Service in the World!
-----== 100,000 Groups! - 19 Servers! - Unlimited Download! =-----
| |
| A. Sinan Unur 2004-09-22, 4:00 pm |
| Alont <end@dream.life> wrote in news:4151a17b.15044562@130.133.1.4:
> just tell me the name of module,
Don't order people around.
> my english too poor to can't understand all module help files, forgive
> me....
Oh, you put your entire question in the subject line. Don't do that.
(This has nothing to do with your language abilities, it is just common
sense).
Your question was:
> what module could easiely load all files to a @array
> from a specified folder(and subfolders)?
Well, there is actually a nontrivial choice between using a hash versus
an array to store the list of files, so think about that. It depends on
what you want to do with those files ones you have the names.
Take a look at File::Find or File::Finder.
--
A. Sinan Unur
1usa@llenroc.ude.invalid
(remove '.invalid' and reverse each component for email address)
| |
|
| merlyn@stonehenge.com (Randal L. Schwartz)Wrote at 22 Sep 2004
09:23:55 -0700:
>use File::Finder; # in CPAN
>my @array = File::Finder->type('f')->in($specified_folder);
>
So simple! but if I only want *.txt file list, should "type('f')"
change to "type('*.txt')" or "type('txt')"?
--
Your fault as a Government is My failure as a citizen
| |
|
| "A. Sinan Unur" <1usa@llenroc.ude.invalid>Wrote at 22 Sep 2004
18:15:36 GMT:
>Don't order people around.
sorry soory, it's not what I want describe, it's my failure in english
language, my original meaning is that I've read a lot of CPAN module,
but can't find what I want, in fact I don't want bother people here, I
know everybody have no time to answer stupid question with me, so I
carefully say "just tell me the name"------however, I know what "just"
mean since you tell me :-)
--
Your fault as a Government is My failure as a citizen
| |
| Bernard El-Hagin 2004-09-23, 8:56 am |
| "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
> Alont <end@dream.life> wrote in
> news:4151a17b.15044562@130.133.1.4:
>
>
> Don't order people around.
Which is what you just did. And you did it *knowing* you are doing it,
which definitely can't be said for Alont, who, which he made quite
clear, is not a native speaker of English. Didn't that give you a clue?
--
Cheers,
Bernard
| |
| Tore Aursand 2004-09-23, 8:56 am |
| On Thu, 23 Sep 2004 00:02:27 +0800, Alont wrote:
> just tell me the name of module,
File::Find::Rule is one of my favorites;
my @files = File::Find::Rule->file()->name( '*.txt' )->in( $directory );
--
Tore Aursand <tore@aursand.no>
"What we anticipate seldom occurs. What we least expected generally
happens." (Benjamin Disraeli)
| |
| Gerhard M 2004-09-23, 8:56 am |
| Alont <end@dream.life> wrote in message news:<4151a17b.15044562@130.133.1.4>...
> just tell me the name of module,
> my english too poor to can't understand all module help files, forgive
> me....
maybe you mean this:
perl -e '@array=<>; #your code' directory/*
this will load all files (content of files, not filename) in directory to @array
Gerhard
| |
| krakle 2004-09-23, 8:58 pm |
| Alont <end@dream.life> wrote in message news:<4151a17b.15044562@130.133.1.4>...
> just tell me the name of module,
> my english too poor to can't understand all module help files, forgive
> me....
Here's a better question... If your english is too poor to understand
a plain english help file how is your english going to be sufficient
enough to understand a plain english reply? :)
| |
| krakle 2004-09-23, 8:58 pm |
| "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@lido-tech.net> wrote in message news:<Xns956D661FBBE0Delhber1lidotechnet@62.89.127.66>...
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote:
>
>
>
> Which is what you just did.
Touche.
| |
|
| krakle@visto.com (krakle)Wrote at 23 Sep 2004 10:05:46 -0700:
>Here's a better question... If your english is too poor to understand
>a plain english help file how is your english going to be sufficient
>enough to understand a plain english reply? :)
in the beginning I read the help file of File::find ,but can't find a
way to easiely solve my problem(so I doubt if I really all understand
the help file), after Peter Scott tell me there have a module named
"File::finder" from CPAN and He give me an usage example, then,
question over :-)
BTW: My reading speed are very slow, but I always do, maybe this is a
way to improve my english level, I also fear if I ask stupid question
here are unmoral, this group always so busy, but if I did, I hope
people forgive me, sometimes I don't post "thank you" to people who
help me, because I think this kind of post also waste people's time in
this busy group.
--
Your fault as a Government is My failure as a citizen
| |
| Bart Lateur 2004-09-24, 4:01 pm |
| Alont wrote:
>in the beginning I read the help file of File::find ,but can't find a
>way to easiely solve my problem
use File::Find;
my @ls;
find sub {
push @ls, $File::Find::name if -f;
}, "/dir/to/check", "/another/dir/to/check";
# now, look in @ls...
--
Bart.
|
|
|
|
|