5 Replies Latest reply on Jan 12, 2015 5:44 AM by Loic.Aigon

    Windows : Permission denied on Folder.rename()

    Loic.Aigon Adobe Community Professional

      Hi all,

       

      First of all, I was told this topic has already been covered but after several searches, still couldn't find any related post. If I missed the obvious, feel free to redirect me.

       

      Here is my problem. I have a routine for renaming folders and subfolders, indesign files and indesign books files. All the links have to be updated regarding to the new name and book also.

      On mac, no problem. This can be launched dozens of times in a row without any problems.

       

      On Windows (7&8, didn't try on former versions), the rename routine can be successfully ran once. Then it stops working. The Folder.rename() method systematically returns false. Reason why ? Permission denied. Then I checked the rights, all ok. I tried VB, command line and finally manual rename, I got returned "Permission denied" every time.


      For the sake of completeness, the files are on a network drive that users map. So all the rename operations occur through the network. I am guessing that once the first rename happens, some operations keeps hand on the files and folders. But I have no clue how to validate this theory.

       

      Do anyone of you ever faced this issue ? And of course find a way out ?

       

      Thanks in advance for any hint,

       

      Best regards,

       

      Loïc

        • 1. Re: Windows : Permission denied on Folder.rename()
          TᴀW Adobe Community Professional & MVP

          Longshot: Are you running the script from the User folder or the

          Application folder? The Application folder sometimes has higher privileges.

          • 2. Re: Windows : Permission denied on Folder.rename()
            Loic.Aigon Adobe Community Professional

            Hi,

             

            Certainly from the user folder. I will give a try with the application folder.

             

            Thanks for the hint. I com back to you as soon as I have some feddback.

             

            Loic

            • 3. Re: Windows : Permission denied on Folder.rename()
              Dirk Becker Level 4

              If this is a generic approach, then don't assume that Mac is too easy. I've had incidents where a folder on a GPFS volume mounted via NFS on a OSX file server, then mounted via AFP on a workstation, would not follow name changes (via separate machine). I tracked that down to caches within the Carbon side of the Mac workstation's OS, outside InDesign. Of course Carbon is dead with CC and I have not retried, but just wanted to mention that case.

               

              If Linux is involved (for the server?), it can also play games with names that in OSX would be expected to be canonized(?) or precomposed, regardless of Carbon or not.

              Technical Q&A QA1173: Text Encodings in VFS

               

              On the Mac I found out some of the problems via kernal trace (dtrace, Instruments) and command line utilities such as lsof. Without own experience I think for Windows a good first tool would be Sysinternals / Process Explorer.

               

              Dirk

              • 4. Re: Windows : Permission denied on Folder.rename()
                Loic.Aigon Adobe Community Professional

                Hi Dirk,

                 

                Thanks for you detail feedback and the tools you propose. I will test them and let you know.

                 

                Best regards,

                 

                Loic

                • 5. Re: Windows : Permission denied on Folder.rename()
                  Loic.Aigon Adobe Community Professional

                  Hi Dirk,

                   

                  Happy new Year 2015 to you and all other fellows here

                   

                  I finally got time to investigate my issue with the tool you suggested. I unfortunately couldn't clear infos with it but it was worth the try anyway.

                   

                  Also, I did some further attempts this morning and noticed something I didn't so far. Eventually it would deal with some "cache" for InDesign. Let me explain :

                   

                  If I :

                  1) open InDesign

                  2) run my script

                  3) target a folder

                  4) ask for a renaming process

                   

                  Then it's ok all the time. I can do multiple rename.

                   

                  However if I open/close any of the file within that folder, the folder is no longer rename-able as long as I don't close InDesign. On next startup, If I do the previous steps, it's working fine. I double checked that InDesign had no open documents or books. The fact that restarting InDesign seems to solve the issue makes me think to some "cache" that even once the document was closed, some connection remains on a sub-level. I agree it's highly theoritical but it' the only way I can explain what I see.

                   

                  I thought I would try to empty the temp folder in case it would magically solve my issue but of course not. Some log files aren't removable anyway.

                   

                  Also, if some files or subfolders i highlighted on the explorer, the rename fails. But I am not really surprised and it's something that clearly is beyond the scope of scripting here.

                  Well nothing new. I just wanted to share my last observations.

                   

                  Best regards,

                   

                  Loic