|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Copy fileHello!
I have a folder with few big files (about 1GB). I would like to copy them to other folder. But "one after one". How can I now, that first copy of first file ended? I would like to run my special event (like writing to the eventlog) and then start to copying second file. Leszek well you could do it this way
Dim strfiles() as String = Io.Directory.GetFiles("C:\SomeDirectory") Dim fs as New IO.FileStream("C:\LogFile.txt", IO.FileMode.Create, IO.FileAccess.Write) Dim sw as New IO.StreamWriter(fs) try for each str as String in strFiles File.Copy(str, "C:\DestinationDirectory") sw.WriteLine("Some log stuff here") next catch ex as exception MsgBox(ex.Message) Finally sw.flush() sw.close fs.close() end try which will copy all files in a given directory and write a log file after each one....hope this is what you meant -- -iwdu15 Thanks!
I didn't try, that file.copy is waiting to finish copying file. Show quoteHide quote U¿ytkownik "iwdu15" <jmmgoalsteratyahoodotcom> napisa³ w wiadomo¶ci news:114BC31F-3A02-4312-AD72-29AA708605B7@microsoft.com... > well you could do it this way > > Dim strfiles() as String = Io.Directory.GetFiles("C:\SomeDirectory") > > Dim fs as New IO.FileStream("C:\LogFile.txt", IO.FileMode.Create, > IO.FileAccess.Write) > > Dim sw as New IO.StreamWriter(fs) > > try > > for each str as String in strFiles > > File.Copy(str, "C:\DestinationDirectory") > > sw.WriteLine("Some log stuff here") > > next > > catch ex as exception > > MsgBox(ex.Message) > > Finally > > sw.flush() > sw.close > fs.close() > > end try > > > which will copy all files in a given directory and write a log file after > each one....hope this is what you meant > > -- > -iwdu15
WithEvents
Design related question Databind to ToolStripDropDown? Imitating a Webform in a Winform resize an image and keep it's proportion? timer start at specific time listbox displaymember & valuemember How to use ADO.NET to run a data set returned stored procedure ? URL Timers run on the creating thread? |
|||||||||||||||||||||||