开发者

how to transfer files using vb.net

开发者 https://www.devze.com 2022-12-21 03:47 出处:网络
is it possible to transfer files using vb.ne开发者_高级运维t? Cutting the files from a certain directory and copy it to anotherYou can use the File class and its Move method.

is it possible to transfer files using vb.ne开发者_高级运维t? Cutting the files from a certain directory and copy it to another


You can use the File class and its Move method.

Or the FileInfo class and its MoveTo method.

If you want to move whole directories, there are the Directory and DirctoryInfo classes and their associated Move and MoveTo methods.

With all of the above, if you do want copies, instead of moving files, use the Copy and CopyTo methods, which work similarly to the Move and MoveTo methods.

This is applicable to all .NET languages, not only VB.NET.


The FileInfo class has a MoveTo method that you can use.


try this

Dim dd As New DirectoryInfo(dirname)

    For Each ff As FileInfo In dd.GetFiles("*.CSV", SearchOption.TopDirectoryOnly)
        ff.CopyTo(sentPath + "\Sent\" + SentFolder + "\" & ff.Name, True) '
        If File.Exists(sentPath + "\" & ff.Name) Then
            File.Delete(sentPath + "\" & ff.Name)
        End If

    Next
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号