I need to recursively document a bunch of Shapefiles using orginfo in many directories. For example,
$ tree -P *.shp
.
├── acfish2s
│ └── acfish2.shp
├── airports
│ ├── airport_runways.shp
│ └── airports.shp
├── aquifer_contactss
│ └── aquifer_contacts.shp
├── aquifer_polygonss
│ └── aquifer_polygons.shp
├── armoriess
│ └── armories.shp
├── ashab3s
│ └── ashab3.shp
I've found something that works for the first layer, but then dies with "FAILURE: Couldn't fetch requested layer".
from ~/airports
$ find ./* -type f -name \*.shp | xargs -0 /bin/GDAL/./ogrinfo.exe -ro -so -fields=YES -geom=SUMMARY $x ${x%.*}
INFO: Open of `airports.shp'
using driver `ESRI Shapefile' successful.
Layer name: airports
Geometry: Point
Feature Count: 212
Extent: (341172.066500, 4778235.208900) - (656874.933400, 5237120.513500)
Layer SRS WKT:
PROJCS["NAD_1983_UTM_Zone_19N",
GEOGCS["GCS_North_American_1983",
DATUM["North_American_Datum_1983",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",500000.0],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",-69.0],
PARAMETER["Scale_Factor",0.9996],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]
SITENUMBER: String (254.0)
<snip>
DOTID: Integer (10.0)
FAILURE: Couldn't fetch requested layer ./airport_runways.shp
./airports.shp
!
when I do it from a higher level, I get the following error
$ find ./* -type f -name \*.shp | xargs /bin/GDAL/./ogrinfo.exe -ro -so -fields=YES -geom=SUMMARY $x ${x%.*}
FAILURE:
Unable to open datasource `airports.shp' with the following drivers.
-> ESRI Shapefile
-> MapInfo File
-> UK .NTF
<snip>
I was thinking it was a BASH thing, but the stat command (mostly) works.
$ find ./* -type f -name \*.shp | xargs stat $x
stat: cannot stat `airports.shp': No such file or directory
File: `./acfish2s/acfish2.shp'
Size: 11428 Blocks: 12 IO Block: 65536 regular file
Device: b054e692h/2958354066d Inode: 844424930137000 Links: 1
Access: (0644/-rw-r--r--) Uid: (57187/john.zastrow) Gid: (10513/Domain Users)
Access: 2005-03-18 10:38:56.000000000 -0500
Modify: 2005-03-18 10:38:56.000000000 -0500
Change: 2012-11-27 00:09:45.025730200 -0500
Birth: 2012-11-27 00:09:44.967726900 -0500
File: `./airports/airports.shp'
Size: 6036 Blocks: 8 IO Block: 65536 regular file
Device: b054e692h/2958354066d Inode: 844424930137006 Links: 1
Access: (0644/-rw-r--r--) Uid: (57187/john.zastrow) Gid: (10513/Domain Users)
Access: 2011-03-02 08:51:18.000000000 -0500
Modify: 2011-03-02 08:51:18.000000000 -0500
Change: 2012-11-27 00:09:45.365749700 -0500
Birth: 2012-11-27 00:09:45.304746200 -0500
File: `./airports/airport_runways.shp'
Size: 32960 Blocks: 36 IO Block: 65536 regular file
Device: b054e692h/2958354066d Inode: 281474976715722 Links: 1
Access: (0644/-rw-r--r--) Uid: (57187/john.zastrow) Gid: (10513/Domain Users)
Access: 2011-03-02 08:50:58.000000000 -0500
Modify: 2011-03-02 08:50:58.000000000 -0500
Change: 2012-11-27 00:09:48.799946100 -0500
Birth: 2012-11-27 00:09:48.735942400 -0500