in reply to creating an index of files contents
Hi nirelit,
Any ideas on how would you approach this?
One way is to use the core module File::Find, you can get the full filename of each found file from the variable $File::Find::name, and use File::Spec's splitdir to split the filename into its components. The reverse index could be done with a hash, assuming there's enough memory for all the entries to fit in.
That's just one way, there are also the modules File::Find::Rule, Path::Class, or Path::Tiny, but the above has the advantage that it uses only core modules. The advantage of Path::Class and Path::Tiny is that they also have methods built in to slurp the files, which would make creating your index files a little bit easier.
Hope this helps,
-- Hauke D
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: creating an index of files contents
by nirelit (Initiate) on Sep 23, 2016 at 09:58 UTC | |
by haukex (Archbishop) on Sep 23, 2016 at 10:35 UTC | |
by haukex (Archbishop) on Sep 23, 2016 at 12:24 UTC | |
by nirelit (Initiate) on Sep 23, 2016 at 13:03 UTC |