ListFeatureClasses (arcpy)
サマリ
Lists the feature classes in the workspace, limited by name, feature type, and optional feature dataset. A Python List is returned from the function.
説明
The workspace environment must be set first before using several of the List functions, including ListDatasets, ListFeatureClasses, ListFiles, ListRasters, ListTables, and ListWorkspaces.
構文
パラメータ | 説明 | データ タイプ |
wild_card |
ワイルドカードを使用して、返される結果を絞り込むことができます。ワイルドカードを指定しない場合は、すべての値が返されます。 | String |
feature_type |
The feature type to limit the results returned by the wild card argument. Valid feature types are:
(デフォルト値は次のとおりです All) | String |
feature_dataset |
Limits the feature classes returned to the feature dataset, if specified. If blank, only stand-alone feature classes will be returned in the workspace. | String |
データ タイプ | 説明 |
String |
The Python List containing feature class names is returned from the function, limited by the optional wild card, feature type, and feature dataset arguments. |
コードのサンプル
Copy shapefiles to a geodatabase.
import arcpy
from arcpy import env
import os
# Set the workspace for the ListFeatureClass function
#
env.workspace = "c:/base"
# Use the ListFeatureClasses function to return a list of
# shapefiles.
#
fcList = arcpy.ListFeatureClasses()
# Copy shapefiles to a file geodatabase
#
for fc in fcList:
arcpy.CopyFeatures_management(
fc, os.path.join("c:/base/output.gdb", os.path.splitext(fc)[0]))