Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
If you have to access just a few files, your method is probably already good enough.

If not, I can think of two methods to speed it up, both allow you to use all-lowercase filenames in your program:

1) Whenever your program starts, it checks whether there are still mixed-case filenames around (just check one file) and if yes, changes them all to lowercase (or uppercase if you prefer that). This means that when someone starts your program the first time with the downloaded data files, your program needs a little longer to start up. The next time all the files are already lowercase.

2) Generate a hash at startup that has the lowercased filename as key and the (real) mixed case filename as value. To access a file, look it up in the hash. The hash has to be generated whenever someone starts the program, but it shouldn't be a noticable delay because the program has to make just one sweep of the files on disk.

PS: Both algorithms need to do a sweep of the data files on disk. You might use File::Find to do this.


In reply to Re: Legacy Data Files on a Case-sensitive File-system by jethro
in thread Legacy Data Files on a Case-sensitive File-system by pobocks

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 21:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found