0
我已經寫了一個數據分類器,它向它正在寫入的文件寫出一個.build擴展名,所以在向特定文件寫入數據時沒有任何東西試圖解除它。在VB.NET中重命名文件擴展名
最後,我想在程序關閉之前用.build擴展名重命名爲.dat。
For Each f In outputFiles
For Each r In TrailerRecords
' Set the bill count variable
If r.VariableField Then
r.Fields(1) = String.Format("{0:000000}", f.Value)
End If
' Write the trailer record to the output file
File.AppendAllText(f.Key, r.ToString() & vbLf)
Next
' Rename all.build files to .dat
NEEDS TO GO HERE
' Copy each output file to the backup directory
File.Copy(f.Key, Path.Combine(backupFolder, Path.GetFileName(f.Key)), True)
Next
End Sub
你讀過http://stackoverflow.com/questions/10784613/how-to-rename-file-in-vb-net?它看起來會解決你的問題。 – SolarBear 2013-03-12 13:01:30