Created
February 26, 2018 15:12
-
-
Save emilladia/4d6aa81a9bacd2df97e28cbc1522e587 to your computer and use it in GitHub Desktop.
secret
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System | |
Imports System.IO | |
Imports System.Text | |
Public Class Form2 | |
Dim files As New ArrayList | |
Dim inDir As String = "D:\CopyTo\" | |
Dim outDir As String = "D:\CopyHere\" | |
Public Sub SearchFiles(ByVal Pattern As String, ByVal Path As String, ByVal FilesFound As ArrayList) | |
FilesFound.AddRange(Directory.GetFiles(Path, Pattern)) | |
End Sub | |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click | |
SearchFiles("*.txt", inDir, files) | |
Try | |
For Each file As String In files | |
Dim fName As String = Path.GetFileName(file) | |
My.Computer.FileSystem.CopyFile(file, outDir & "\" & fName, overwrite:=False) | |
Next | |
Catch ex As Exception | |
'MessageBox.Show(ex.ToString) | |
Console.WriteLine(ex.ToString) | |
End Try | |
End Sub | |
End Class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment