Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Borland > Re: Long filena...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 23 of 23 Topic 1046 of 1118
Post > Topic >>

Re: Long filename sup****t in Windows Vista

by Dr J R Stockton <jrs@[EMAIL PROTECTED] > Aug 23, 2007 at 08:05 PM

In comp.lang.pascal.borland message <1187883289.124454.112390@[EMAIL PROTECTED]
>, Thu, 23 Aug 2007 08:34:49, Jim Leonard
<MobyGamer@[EMAIL PROTECTED]
> posted:
>
>Here's what I'm trying to write:  A friend has asked me for a utility
>that will take a size parameter (like "700MB") and copy random files
>from a source directory (including recursing to subdirectories) to a
>target directory.  This is so he can randomly fill things like his
>music player or his digital picture frame with new content every day.
>
>My idea was to write it in TP, since it's very quick for me to write a
>small utility like this in TP, but then I thought of the following:

>- Memory.  Using my own MP3 collection as a testbed, I have over 9700
>music files.  Assuming an average directory depth+name of 64 bytes,
>building a list of the available files to copy would exceed the 640K
>RAM available.  So a Win32 compiler is an option simply so I have more/
>virtual memory available.

ISTM that you don't need to store all that.  It seems safe to disregard
the possibility that, during the copying, the candidate file set will be
changed.

First, scan the whole target area, counting (from 0 to N) the eligible
files.

Now choose file numbers in that range at random, and for each choice
scan again up to that number, and note in an ordered list the number and
maintain the ac***ulated size.  Repeat, but check in the list for
duplicates, until the target size is more-or-less reached.  Some minor
refinements may be needed, but that should solve the storage problem.

The scans subsequent to the first will probably read from cache, so
should be quick.

If you know that you have 700 MB to fill, and no files are bigger than
50 MB, then you can generate 14 randoms and do all in one scan, if that
helps; then see how much space is left, and iterate.

Untested.

-- 
 (c) John Stockton, Surrey, UK. *@[EMAIL PROTECTED]
 /
??.Stockton@[EMAIL PROTECTED]
 Web  <URL:http://www.merlyn.demon.co.uk/>
- FAQish topics, acronyms, &
links.
 Correct <= 4-line sig. separator as above, a line precisely "-- "
(SoRFC1036)
 Do not Mail News to me.    Before a reply, quote with ">" or "> "
(SoRFC1036)
 




 23 Posts in Topic:
Long filename support in Windows Vista
Jim Leonard <MobyGamer  2007-08-21 06:45:06 
Re: Long filename support in Windows Vista
Wolf Behrenhoff <NoSpa  2007-08-21 19:08:19 
Re: Long filename support in Windows Vista
Robert Riebisch <Rober  2007-08-22 09:08:30 
Re: Long filename support in Windows Vista
Jim Leonard <MobyGamer  2007-08-22 09:55:06 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 06:40:47 
Re: Long filename support in Windows Vista
Jim Leonard <MobyGamer  2007-08-22 09:56:30 
Re: Long filename support in Windows Vista
Robert Riebisch <Rober  2007-08-23 09:27:01 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 07:32:37 
Re: Long filename support in Windows Vista
Robert Riebisch <Rober  2007-08-23 10:08:08 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 08:27:40 
Re: Long filename support in Windows Vista
Robert Riebisch <Rober  2007-08-23 11:19:47 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 13:21:31 
Re: Long filename support in Windows Vista
Robert Riebisch <Rober  2007-08-23 15:41:22 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 18:24:35 
Re: Long filename support in Windows Vista
"Heinrich Wolf"  2007-08-22 20:26:11 
Re: Long filename support in Windows Vista
Dr J R Stockton <jrs@[  2007-08-22 18:49:28 
Re: Long filename support in Windows Vista
hartnegg <hartnegg@[EM  2007-08-23 04:36:48 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 12:08:51 
Re: Long filename support in Windows Vista
Jim Leonard <MobyGamer  2007-08-23 06:59:56 
Re: Long filename support in Windows Vista
Jim Leonard <MobyGamer  2007-08-23 08:34:49 
Re: Long filename support in Windows Vista
Marco van de Voort <ma  2007-08-23 19:21:32 
Re: Long filename support in Windows Vista
Dr J R Stockton <jrs@[  2007-08-23 20:15:09 
Re: Long filename support in Windows Vista
Dr J R Stockton <jrs@[  2007-08-23 20:05:19 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 0:25:24 CDT 2008.