AnsweredAssumed Answered

Python script to Compact geodatabases in multiple directories?

Question asked by kjdowdy4026 on Jan 7, 2015
Latest reply on Jan 8, 2015 by kjdowdy4026

I am trying to write a python script to walk through all folders in my workspace and find and compact all geodatabases in my workspace. I am using the 10.2.2 release.

import acrpy, os 
from arcpy import env 

arcpy
.env.workspace "C:" 

for
(path, dirs, files) in os.walk(arcpy.env.workspace)
    for file in files if ".gdb" in file:
        workspaces
= arcpy.ListWorkspaces("*", "FileGDB")
        for workspace in workspaces:
            arcpy
.Compact_management(workspace)

Outcomes