Folder Access Denied

Using (or providing) components based on the "Win32" framework

Folder Access Denied

Postby quant36 on Wed Jul 19, 2017 3:20 pm

I wrote a function that re-creates a folder's structure, with all of its sub-folders, in a different location. One interesting thing I noticed during this exercise is that, sometimes, deleting a newly created folder (after the function's completion) results in "Folder Access Denied" error message. Resetting or Clearing the workspace doesn't improve the situation... only closing the session solves the problem.

Is this a Windows or Dyalog issue? And why is it not consistent?

Thanks,
Andrew
Version: 13.1.22502.0 64 Classic
Created: Sep 15 2014 at 17:51:27
Build ID: 46578546.
quant36
 
Posts: 4
Joined: Fri Feb 26, 2010 6:25 pm
Location: Sunny Isles Beach, FL / Boston, MA

Re: Folder Access Denied

Postby Richard|Dyalog on Thu Jul 20, 2017 9:54 am

You don't say how you are creating the copy but my guess is that you cannot delete it again when there is still a file tied within it. Note that: (1) Windows will not allow you to delete a file or directory that is tied; (2) )CLEAR does not untie files.

You can test this theory by entering the following when you get the error and then retrying:

Code: Select all
⎕NUNTIE ⎕NNUMS
⎕FUNTIE ⎕FNUMS


As an aside: in 13.1 it was not possible to create a directory using the native file functions so there must have been a call to native Windows code to do that. You may be interested to know:

  • In 15.0, ⎕MKDIR was introduced, which adds that capability
  • We are currently planning to introduce ⎕NCOPY to next year's release which will copy files and entire directories
User avatar
Richard|Dyalog
 
Posts: 29
Joined: Thu Oct 02, 2008 11:11 am

Re: Folder Access Denied

Postby quant36 on Thu Jul 20, 2017 11:52 am

Hi Richard!

I create the copy with recursive "⎕CMD'MKDIR ',somepath " command and NtDirX function. There are NO FILES involved in the process, only sub-folders. I had checked ⎕fnums & ⎕nnums before trying to delete the copy folder and no files were ever tied. Again, sometimes the deletion of the copy works, sometimes it doesn't.

One additional piece of information: the copy contains several hundred sub-folders.

Thanks,
Andrew
quant36
 
Posts: 4
Joined: Fri Feb 26, 2010 6:25 pm
Location: Sunny Isles Beach, FL / Boston, MA

Re: Folder Access Denied

Postby Richard|Dyalog on Thu Jul 20, 2017 3:08 pm

Thanks for the additional info. We have been discussing what might be happening but there is no clear explanation. Could you send your code that creates the directories (including the copy of NtDirX that you are using), and the code that deletes then if that is also done from APL, to support@dyalog.com so we can try to reproduce it? Thanks!
User avatar
Richard|Dyalog
 
Posts: 29
Joined: Thu Oct 02, 2008 11:11 am

Re: Folder Access Denied

Postby tclviii-dyalog on Thu Jul 20, 2017 4:35 pm

Dear quant36

When I first read of you recreating a directory structure I thought that you might be using the windoze "robocopy" command with the appropriate switches (which would involve no file ties)

N.B to Richard: please consider having some of the robocopy "switches" included into quadNcopy (in particular, the ability to preserve the original timestamps rather than all file timestamps being reset to the quadNcopy execution time timestamp)

TonyC
tclviii-dyalog
 
Posts: 3
Joined: Tue Mar 02, 2010 6:04 pm

Re: Folder Access Denied

Postby Michael|Dyalog on Fri Jul 21, 2017 6:23 am

Sorry, this might be silly - but your mention of "several hundred subfolders" just made me think: Is there a chance that the copy is still busy while you're trying to delete stuff? Perhaps that would also explain the "sometimes"-thing, as it would then just depend on the time you are waiting before deleting...Are you doinig it all in a single thread or is multithreading involved?
Michael|Dyalog
 
Posts: 6
Joined: Thu Mar 02, 2017 4:29 pm


Return to Windows: GUI, COM/OLE/ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest