2011年7月13日 星期三

.Net 讀文字檔兼拆字串兼備份檔案兼刪檔

Dim t, t1(), t2 As String


For Each f As String In My.Computer.FileSystem.GetFiles( txt文字檔目錄.Text, FileIO.SearchOption.SearchTopLevelOnly, "*.txt")
            Dim fi As FileInfo = My.Computer.FileSystem.GetFileInfo(f)
            t = My.Computer.FileSystem.ReadAllText(fi.FullName, System.Text.Encoding.Default)
            t1 = t.Split(",")


            aaa = t1(0)
            bbb = t1(1)


           My.Computer.FileSystem.CopyFile(fi.FullName, txt文字檔備份目錄.Text & "\" & fi.Name, True)
           My.Computer.FileSystem.DeleteFile(fi.FullName)
Next

沒有留言:

張貼留言