Can't copy files from shared network drive


(Lazza) #1

I have an action in my CI stage that fails unexpectedly when copying some files from a shared network drive. The weird fact is that I can copy those files to that same drive in later stages of my build configuration.

Below you can see the log of the last two actions:

If Exists [\\SHARED_DRIVE\folder\%BranchName%\%RepoName%\\]
	The directory '\\SHARED_DRIVE\folder\branch\repo\otherName\' has been checked and found to exist.
    Copy [\\SHARED_DRIVE\folder\%BranchName%\%RepoName%\]
		Overwrite existing files: True 
		List each copied item: True
		Fail if no files are copied: False
		Copying files in folder '\\SHARED_DRIVE\folder\child_folder1\child_folder2\' matching pattern(s) 'binaries_folder/**.*' to folder '\\SHARED_DRIVE\folder\child_folder1\child_folder2\'
		Failed to copy file '\\SHARED_DRIVE\folder\child_folder1\child_folder2\binaries_folder\sourcePath.txt'. (32) The process cannot access the file because it is being used by another process: [\\?\UNC\SHARED_DRIVE\folder\child_folder1\child_folder2\binaries_folder\sourcePath.txt]

(Dave Sparks) #2

This implies that the source file is locked by another process when attempting to open the file for copying. Unfortunately the error message from Windows does not tell us which process is locking the file.

It could be a background process on the ‘SHARED_DRIVE’ computer such as anti-virus protection or back up software. It may be that a previous build action still has the files open. It is also possible that two running builds are trying to access the files at the same time - if so we would recommend using shared resources.

Does this happen every time you run a build or intermittently?