Scripting Question

How to check whether a file copied completely?

11/19/2016 1461 views

There is a build machine in the network where it will automatically download the code from source repository and compile using visual studio and compresses the complete code in a zip file.

I have added a line at the end of the build script(written in python on that machine) to copy that zip file to my ESX Virtual machine.

Where I kept a AutoIT exe to wait for the zip file, once it is copied then I will extract the contents and find only the dll files in the extracted folder and do the Install creation using Installshield silently and copy the created setup files to anther machine.

I wrote the script till the setup files creation.


But now the problem is, when the zip file is copying through network, the autoit script is detecting it even the copy is still in progress and trying to extract the zip file and failing.

Even when I am checking whether the file in use is not working.


Any suggestion on how to check whether the copy is completed.?

0 Comments   [ + ] Show comments


Community Chosen Answer

Try doing a doing file size check every minute until the size is static.  once static, proceed.

Or if really want to ensure the file is correct, you could CRC the source then compare the file after the file size becomes static. I recommend CRC as that will be faster than MD5 or SHA1, i think the later would be a bit over kill.
Answered 11/20/2016 by: rileyz
Red Belt

  • Looks bit complicated. :)
    Present, I am copying one more empty text file after I copied this file as a confirmation of copy complete.

All Answers

You could also add a timer.   Once the file is detected, wait ten minutes before running the next command.
Answered 11/21/2016 by: vjaneczko
9th Degree Black Belt

  • But the copy time may vary based on network right.
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ