VB.Net ファイル操作 [.NET]
.Netでフォルダやファイルの削除、存在チェックは以下のようにできます。
便利ですね。
.NETファイル操作
1 2 3 4 5 6 7 8 9 | System.IO.Directory.Delete(sPath) 'フォルダ削除' System.IO.Directory.CreateDirectory(sPath) 'フォルダ作成' 'フォルダ存在確認' If System.IO.Directory.Exists(sPath) Then MsgBox( "存在します。" , vbInformation) Else MsgBox( "存在しません。" , vbExclamation) End If |
.NETフォルダ操作
1 2 3 4 5 6 7 8 9 | System.IO.File.Delete(sPath) 'ファイル削除' System.IO.File.Copy(sPathFrom, sPathTo) 'ファイルコピー' 'ファイル存在確認' If System.IO.File.Exists(sPath) Then MsgBox( "存在します。" , vbInformation) Else MsgBox( "存在しません。" , vbExclamation) End If |
便利ですね。
コメント
コメントを投稿