kuldeepchowhan has asked for the wisdom of the Perl Monks concerning the following question:
I have a script which checks two drives (A & B) for the maximum free space available and starts copying to the drive which has the maximum free space available (lets say A).
Free Space :
A : 12GB
B : 6GB
Files to the copied : 5GB
In the mean time if other instance of the script is started which needs to copy 8 GB of files and even at that moment of time if A drive has the maximum free space, then the script starts copying files to the A drive only and after sometime as both the sizes add up to 13 GB, the script fails to copy the files successfully.
What is the best way to avoid this and make sure that the second instance of the script doesn't write to the same drive.
I have an idea to create a temp file in the drive in which i am copying the files and skip that drive if the file exists.
Is there any other effective way of doing this ?
|
|---|