[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Puzzle - Temp file creation



<unlurk>
wouldn't it be more reliable - for finding a temp filename - to use
something like
time() to get an almost definitely unique filename? or did I get lost in all
the subthreads?

i can see how all this is intellectually fun, but if I need a unique,
non-used filename, there is no way on earth that another file on my system
has the same filename if I append a unix time to the end of it. maybe I
missed the point.
</unlurk>

----- Original Message -----
From: Bernie Cosell <bernie@fantasyfarm.com>
To: <fwp@technofile.org>
Sent: Wednesday, July 14, 1999 10:57 AM
Subject: Re: [FWP] Puzzle - Temp file creation


On 14 Jul 99, at 11:49, Chaim Frenkel wrote:

> >>>>> "BC" == Bernie Cosell <bernie@rev.net> writes:
>
> BC> [bernie@mercury script]$ perl -e '$a = "zzzz"; $a++ ; print $a, "\n" '
> BC> aaaaa
>
> BC> and so it isn't clear it *can* fail... it might loop forever...
>
> Loop forever?
>
> length("zzzz") == 4 length("aaaaa") == 5
>
> perl -wle '$a="z"; print ++$a'
> aa

Right, but if you were using that to find an unused suffix for a temp
file, if all half-million four-letter suffixes were used, you'd step to
'aaaaa' and your program would continue to flog the poor OS, and if all
12-million or so filenames with _five_ chars were in use [which means
that that directory now is know to have 12.5 million files in it! :o)]
you'd just index from 'zzzzz' to 'aaaaaa' and I don't even want to THINK
about what it'd take before your 'find a free file name' loop would get
up to 'zzzzzz'...:o)

  /Bernie\
--
Bernie Cosell                     Fantasy Farm Fibers
mailto:bernie@fantasyfarm.com     Pearisburg, VA
    -->  Too many people, too few sheep  <--

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe


==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe