Hi , what i understand from what you wrote ... that you want to check if the files already exits you won't to copy it again
so you can check that useing if(-e "location/Filename"){do something } this will return true whenever a file is exits ... if you want to copy whenever a file isn't exits use it like this if(!-e "location/Filename"){ do something} this will do what you want like copying whenever a file is not exits ... i hope i got what you're looking for bye On Thu, 17 Feb 2005 11:27:46 +0000, Ken Gillett <[EMAIL PROTECTED]> wrote: > I have a problem that is not exactly a perl problem, but I do have to > implement it in perl, although the implementation is not the problem. > Sorry if that's a bit obscure. > > 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> > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>