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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.