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.
Folder Access Denied
- Richard|Dyalog
- Posts: 44
- Joined: Thu Oct 02, 2008 11:11 am
Re: Folder Access Denied
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:
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:
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
Re: Folder Access Denied
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
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
- Richard|Dyalog
- Posts: 44
- Joined: Thu Oct 02, 2008 11:11 am
Re: Folder Access Denied
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!
-
- Posts: 28
- Joined: Tue Mar 02, 2010 6:04 pm
Re: Folder Access Denied
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
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
-
- Posts: 23
- Joined: Thu Mar 02, 2017 4:29 pm
Re: Folder Access Denied
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?