How can i copy the files that name start with "BUSAE". Full name of the file is BUSAE_211S2.TXT. I would like to copy the file into one directory and paste it into different directory. How can i do it with vb..Below is the code i found but how can i work around the code?
Code:Imports System.IO Imports System.Xml.Linq Module Module1 Sub Main() Try Dim files = From chkFile In Directory.EnumerateFiles("c:\copy\", "*.txt", _ SearchOption.AllDirectories) From line In File.ReadLines(chkFile) Where line.StartsWith("BUSAE") Select New With {.curFile = chkFile, .curLine = line} For Each f In files Console.WriteLine("{0}\t{1}", f.curFile, f.curLine) Next Console.WriteLine("{0} files found.", _ files.Count.ToString()) Catch UAEx As UnauthorizedAccessException Console.WriteLine(UAEx.Message) Catch PathEx As ***********Exception Console.WriteLine(PathEx.Message) End Try End Sub End Module.




Reply With Quote
