Show Navigation | Hide Navigation
You are here:
Writing geoprocessing scripts > Scripting Object: Properties and methods > Properties and Methods

ListWorkspaces method

Release 9.1
Last modified August 19, 2005
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "Properties and Methods"

Related Topics

Lists all workspaces within the selected workspace. Specifying search conditions (wildcard) and a workspace type will limit the results. The workspace must be specified before using any of the List methods, except ListFields and ListIndexes.


object.ListWorkspaces([wild card], [WorkspaceType]) as Object

Returns a Dispatch enumeration object that will, in turn, hand out the names of the workspaces located under the location specified by the WORKSPACE environment. The returned workspaces are folders, Microsoft Access, and SDE.

Part Description
object The instantiated geoprocessing object
wild card Optional. Combination of * and characters that will help limit the results. The asterisk (*) is the same as saying ALL. If no wildcard is specified, then all workspaces will be returned.
WorkspaceType Optional. Keyword WorkspaceType that will limit the returned workspaces. Valid WorkspaceTypes for this method are:
  • Coverage—only coverage workspaces will be selected.
  • Access—only personal geodatabases will be selected.
  • SDE—only SDE databases will be selected.
  • Folder—only shapefile workspaces will be selected.
  • ALL—All workspaces will be selected. This is the default.


from win32com.client import Dispatch
gp = Dispatch("esriGeoprocessing.GpDispatch.1")

gp.workspace = "c:\\county"

# List all access workspaces in the current workspace
workspaces = gp.listworkspaces("*", "access")
workspace =
while workspace:
    # Compact each geodatabase
    workspace =

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.