Skip to content

Instantly share code, notes, and snippets.

@emilladia
Created February 26, 2018 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emilladia/4d6aa81a9bacd2df97e28cbc1522e587 to your computer and use it in GitHub Desktop.
Save emilladia/4d6aa81a9bacd2df97e28cbc1522e587 to your computer and use it in GitHub Desktop.
secret
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