473,387 Members | 1,791 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Copy file

Hello!

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
Jul 11 '06 #1
2 1029
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
Jul 11 '06 #2
Thanks!

I didn't try, that file.copy is waiting to finish copying file.

U¿ytkownik "iwdu15" <jmmgoalsteratyahoodotcomnapisa³ w wiadomo¶ci
news:11**********************************@microsof t.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

Jul 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Claudio Grondi | last post by:
I would like to save time copying the same file (>6 GByte) to various different target storage media connected to the system via USB. Is there a (Python or other) tool able to help me to do...
0
by: SeanR | last post by:
I have a function to copare two files. It will first copy the original file form a different server to a local temp path and then compare that version to a version that has been restored form tape....
0
by: Joshua Ginsberg | last post by:
Howdy -- I have a class that has an attribute that is a dictionary that contains an object that has a kword argument that is a lambda. Confused yet? Simplified example: import copy class...
5
by: DraguVaso | last post by:
Hi, I need a SECURE way to copy parts of a file. I'm having files which contains a whole bunch of records. In one 'fysical' file I'm having one or more logical files. What I need to do is to...
8
by: luis molina Micasoft | last post by:
it seems that when i do file.copy the svchost.exe is hanged, i mean if i make 40 threads of file.copy , 40 copys of files at same time the system is going down and stop responding, this is when i'm...
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
4
by: Emin | last post by:
Dear experts, I got some unexpected behavior in getattr and copy.deepcopy (see transcript below). I'm not sure if this is actually a bug in copy.deepcopy or if I'm doing something too magical...
1
by: ajc308 | last post by:
I'm attempting to sort the <file>s within each <directory> in my XML according to their file extension, then write out the resulting sorted data back to XML format. I had it working before, and when...
3
by: maheshkadam | last post by:
Hi friends I am new to perl so please guide me. I have one application which created backup log file every day.But it appends that file so you can see logs for different day in one file only. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.