Jerry Trac
Jerry Trac

Reputation: 367

Vb.net Copy file to all subfolder

I have a Folder called Users. This Folder a 3 subfolders at the root: A , B, and C. How would I use vb.net to copy a file into the root of all of these subfolders?

Thanks

Upvotes: 0

Views: 490

Answers (1)

SMS
SMS

Reputation: 462

Look into this example

Dim fi As New FileInfo("D:\file1.txt")
Dim dirs As DirectoryInfo() = New DirectoryInfo("D:\Root").GetDirectories()

For Each d As DirectoryInfo In dirs
    fi.CopyTo(d.FullName, True)
Next

Hope it helps.

Upvotes: 1

Related Questions