Created
August 1, 2012 06:16
-
-
Save nvkelso/3224210 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# loop through all of the shapefiles in the directory and act on them | |
# http://trac.osgeo.org/gdal/wiki/FAQVector#HowcanImergehundredsofShapefiles | |
# http://stackoverflow.com/questions/965053/extract-filename-and-extension-in-bash | |
#USAGE: | |
# sh list_dir_of_shps.sh in_dir_path out_dir_path | |
#Capture the shell arguments | |
in_dir_of_shps=$1 | |
out_dir_of_shps=$2 | |
#Ensure the output directory exists | |
mkdir -p ${out_dir_of_shps} | |
#Loop thru all the shps in the input dir | |
for i in $(ls ${in_dir_of_shps}/*.shp); do | |
echo ${i} | |
#Capture each filename | |
filename=$(basename "$i") | |
#extension="${filename##*.}" | |
#filename="${filename%.*}" | |
o=${out_dir_of_shps}/${filename} | |
#echo ${o} | |
python ../ogrtools.py --in_file ${i} --out_file ${o} --function fieldnames_lowercase | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment