Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Transfer-Files doesn't release file after copying it?

    Scheduled Pinned Locked Moved Support
    buildmasterdeployment-plans
    4 Posts 1 Posters 13 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ? This user is from outside of this forum
      Guest
      last edited by

      As part of my deployment plan, I copy a single file from one folder to another on the same box (it happens to be the BuildMaster server). It works fine. Subsequent executions, however, fail because BuildMaster can't get a handle on the file.

      Cannot copy C:\folder1\foo.msi: The process cannot access the file 'C:\folder1\foo.msi' because it is being used by another process.

      This is how I copy it in my plan:

      Transfer-Files
      (
          Include: foo.msi,
          FromDirectory: C:\folder1,
          FromServer: localhost,
          ToDirectory: C:\folder2,
          ToServer: localhost,
          DeleteTarget: true,
          Verbose: true
      );
      

      The only way to get it to work on subsequent executions is to restart the BuildMaster service (which releases the handle on the file).

      Product: BuildMaster
      Version: 5.6.11

      1 Reply Last reply Reply Quote 0
      • ? This user is from outside of this forum
        Guest
        last edited by

        Sorry, but my original error message is actually:

        Cannot copy C:\folder1\foo.msi: The process cannot access the file 'C:\folder2\foo.msi' because it is being used by another process.

        1 Reply Last reply Reply Quote 0
        • ? This user is from outside of this forum
          Guest
          last edited by

          BuildMaster does not lock files in this manner, especially when reading a file. But this is very common for other tools that monitor the file system to do this:

          • Anti-virus, anti-malware
          • Auditing
          • File indexing

          Restarting the service is basically just giving these other tools time to release whatever locks they have acquired. The best solution is to disable those tools for your own files, but when it's not possible, you can easily use a retry block like this:

          with retry=3
          {
             try
             {
                transfer-files;
             }
             catch
             {
                sleep 3;
             }
          }
          
          1 Reply Last reply Reply Quote 0
          • ? This user is from outside of this forum
            Guest
            last edited by

            Thanks, I believe this was caused by the anti-virus program. Once I excluded the folder from the scan, the problem went away.

            1 Reply Last reply Reply Quote 0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post
            Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation