Could not delete folder, Access to the path '...' is denied.

Hey,

I have a little problem to clean up some folders in the end of my plugin process.
The plugin is working with a server application which needed the files to work with in a special location.
So I used the following code to create a specific folder and copy the job files into it:

Directory.CreateDirectory( Path.Combine(SpecificPath,JobId) )

for  argFileName, tmpArgFile in argFilesDict.iteritems():
    File.Copy( argFileName, tmpArgFile, True )

This works fine and the application has access to the files and removes the files inside the created folder.
After my plugin has done its work, I wanted it to cleanup these temp folder with:

File.Delete( Path.Combine(SpecificPath,JobId) )

But I get the following error:

Error in RenderTasks: Access to the path '_the_folder_path_' is denied. (System.UnauthorizedAccessException)
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

I was also trying it with a seperate “CleanUp” event (as OnJobFinished), but it also won’t delete my folder.
The parent folder and all farm machines have full access to the parent directory and its childs.

Is there something wrong with my code? And why does Deadline do not have access to its own created folder?

Thanks

Honestly, I am going to need to ask our devs about this, and today is a holiday in Winnipeg, but I will bring this up first thing tomorrow.

Did you got any feedback from your dev team?

Hi,
Can you post your script to this thread so we can see it in context? It looks like the directory can’t be deleted as the process still has it locked? Seeing the whole script will really help put everything into context. Free feel to send it to support [at] thinkboxsoftware [dot] com to generate a private support ticket if you so wish.

Hey Mike,

the process removes everything inside the directory. It’s process should be done, but maybe you are right and it’s checking the folder another time. Sorry, I can’t post the plugin here. Many parts of it are connections and pre processes for our in house developed pipeline tools. I will talk to my supervisor what we want to do. Thanks

OK. Maybe use Process Monitor to observe what is happening at your end, which might help you get to the bottom of the issue?
technet.microsoft.com/en-us/sys … 96645.aspx

Ok, i’ll test it with the Process Monitor.

Thanks