Jump to content

while loop help


solarisuser

Recommended Posts

Hi All,

 

I'm trying to figure out if a while loop is what I really need to use.  My goal is to copy a dynamic amount of data from C:\ to D:\.

I have a routine to detect the used hard disk space on C:\ and the free disk space on D:\.  If D:\ does not have enough space for the copy, I delete a folder, then I want to run the code again to detect the used hard disk space on C:\ and the free disk space on D:\.  If I still need more space, I delete another folder, and run the code again, etc.

 

Right now I run the code to detect the hard disk size, and if I need to delete a folder, I have:

while($size_to_copy > $size_free)
{
// delete folder
// run code to update $size_to_copy and $size_free
}

 

However, running code inside the while loop to generate an updated $size_to_copy and $size_free do not seem to tell the while loop of the new values.

 

Any direction on my next steps would be great - thanks!

Link to comment
https://forums.phpfreaks.com/topic/119752-while-loop-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.