Last active
December 6, 2018 19:17
-
-
Save maptastik/aa890f0b1c024e0689a2b7bc095213a1 to your computer and use it in GitHub Desktop.
Function that takes a directory as a parameter and returns a list of shapefiles. Although this doesn't explicitly involve arcpy, this function could be used for automating an action on all shapefiles in a directory using arcpy. That said, it could be
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def shps_in_dir(search_directory, full_path = True): | |
shp_list = [] | |
for file in os.listdir(search_directory): | |
if file.endswith('.shp'): | |
shp_list.append(file) | |
if len(shp_list) > 0 and full_path: | |
shp_list = list(map(lambda x: os.path.join(search_directory,x), shp_list)) | |
return shp_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment