Is there a way to get the current directory opened in ArcCatalog 10.0 using ArcPy?
Something like os.getcwd() but instead gives the selected folder on the catalog tree.
Assuming there isn't a way to access the open directory in ArcCatalog (Another issue with this would be if there were two folders open. Would you only want to print out the folder that is currently selected [highlighted?] or every open folder in the tree?), this is probably the easiest way.
This is a super basic script (it's only 3 lines of code!). All you have to do is drag the folder into the script, and it will print out all the images in the directory, like so:
If you wanted to get fancy with it, you could add boolean parameters that would allow you to write the names to a text file and/or utilize other list functions.
import arcpy arcpy.env.workspace = arcpy.GetParameterAsText(0) [arcpy.AddMessage(image) for image in arcpy.ListDatasets()]
I think you are probably looking for
arcpy.env.workspace = <path>
Current Workspace—The workspace from which inputs are taken and outputs are placed when running tools