AnsweredAssumed Answered

best way to rename a folder using ArcPy

Question asked by JFitzsimmons_NYCDOT on Dec 4, 2018
Latest reply on Dec 4, 2018 by JFitzsimmons_NYCDOT

I run a Python script to delete and recreate a set of map services.  To do this, I place a folder with all the mxds and data in the same directory as the existing folder, with a different name. The script then renames the folder using os.rename, and then uses that data for the new map services.


The problem is, I get an 'Access Denied' error when I run this. The error is thrown when renaming the existing folder to 'folder_old'. If I restart the server, it will usually work, but this obviously is not ideal.  The server is an AWS instance, with ArcGIS 10.2.  I have full administrative rights on that machine, and I have IDLE set to run as an administrator.


Is there a preferred ArcPy method to rename a data folder that I should be using instead?