I have thousands ( <50,000 ) of numerically named files that I need to store in 2 different location so that the ratio of numbers of files in each location is maintained at a preset ratio. The files will be repeatedly created and I want to ensure that each time this is done, the same named file is placed in the same location it was last time, therefore a simple alternating process or one that looks at the existing numbers of files would not be suitable, since at each generation of the files they would be unlikely to end up in the same place.
So I really want something that examines the file name and makes a decision based on that, so that every time it sees the same name, it will be placed in the same location - unless there's another way to enforce the same rule?
The file names are numbers between 10 and 10,000,000, with no grouping/order to the naming that would skew the result - assume an even distribution.
Initially the storage requirements are 2:1, so simply dividing the name by 3 would (I think) work, i.e. if the name is exactly divisible by 3 or not could determine in which location to place it. But if I need to change that to e.g. 3:2 it's not so simple and the ratio needs to be flexible so that it can be easily set and/or changed for different setups.
BTW, the background to this is that the list of files will be symlinks to (currently mostly mp3) music files and a larger number of far smaller supporting regular files (mostly text, some binary). The entire structure is to be created on the main server then rsync'd up to a player device which has 2 HDs for the storage, hence the 2 different locations and the need to ensure the files are in the same location every time, otherwise rsync will waste a lot of time deleting and re-copying files simply because they're in a different directory from last time and when playing with almost 100Gb of data this is to be avoided at all costs.
Hope some of you can bring some brain power to work on this as my head hurts...
Ken G i l l e t t
_/_/_/_/_/_/_/_/_/
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>