close

範例:

要將shp 轉成 txt運用資料夾的功能把檔名抓出來
然後再寫成指令碼

shp2pgsql “D:\Share\Alvin\scbtaiwan\SCB_TWN_grid\大台北\grid” “grid” > D:\Share\Alvin\scbtaiwan\SCB_TWN_grid\大台北\grid.txt”

程式碼如下

Dim filePath As String = Server.MapPath(doc + Me.ddlFolder1.SelectedValue + “\” + Me.ddlFolder2.SelectedValue + “\”)
Dim dirInfo As New DirectoryInfo(filePath)
Dim fileInfos() As FileInfo = dirInfo.GetFiles(”*.shp”)
Dim file As String = Me.ddlFirst.SelectedValue
If file = “0″ Then
file = “”
End If
Dim Ans As String
For Each f As FileInfo In fileInfos
Dim filename As String = f.Name

filename = filename.Replace(”.shp”, “”)
Ans += “shp2pgsql “”" + filePath + filename + “”" “”" + file + filename.Replace(”beijing_”, “”) + “”" > “”" + filePath + filename + “.txt”"

Next

Me.Literal1.Text = Ans

arrow
arrow
    全站熱搜

    包爾伯 發表在 痞客邦 留言(0) 人氣()