Need to write a program that copies a file from one location to another

fbrdphreak

Lifer
Apr 17, 2004
17,555
1
0
So I'm endeavoring to write a program that will copy a file or group of files from one location to another and time how long it takes for the file copy to complete.

I've done my share of Java programming, as well as dabbling in numerous other languages.

Could I do something like this with a simple batch file? I know I could copy a file using the batch file, but what about keeping a timer and detecting when the copy is complete?

Any input is appreciated!
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
Using the batch file makes sense
Log the start time
copy the files
Log the finish time

Make sure that you redirect the log to a log file.

Then either develop a function to parse the log file to extract the times, or just use the old fashion eyeball and noddle method.
 

fbrdphreak

Lifer
Apr 17, 2004
17,555
1
0
Great, I'm looking into further batch file commands to figure out the specifics

I'll post back with more questions ;)
 

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
time /t display the time without any prompts
xcopy Lopys the files. To look at the switches(options) for the command xcopy /?
 

fbrdphreak

Lifer
Apr 17, 2004
17,555
1
0
Thanks for the info

A friend also suggested C++ would do this pretty easily, and with some MS Visual C++ that I get free I could make a nice GUI that would hopefully just pop up the time when it was done. Exciting :sun:

But this way should work fine in the intermediate, thanks!
 

xtknight

Elite Member
Oct 15, 2004
12,974
0
71
Use cygwin and do time cp source dest ?

Edit: Apparently the word 'cp_src' gets starred out. :confused:
 

CalvinHobbes

Diamond Member
Feb 27, 2004
3,524
0
0
I use a program called "TimeThis". It will time how long it takes to complete a command line function.
 

fbrdphreak

Lifer
Apr 17, 2004
17,555
1
0
Originally posted by: CalvinHobbes
I use a program called "TimeThis". It will time how long it takes to complete a command line function.
Got a link? Not seeing it on initial googling
 

Nothinman

Elite Member
Sep 14, 2001
30,672
0
0
cygwin can be significantly slower than normal operations in Windows though, I would take it's results as gospel.

If you install the Windows PowerShell (really, really gay name) you can use 'measure-command {copy source dest}' in there.
 

fbrdphreak

Lifer
Apr 17, 2004
17,555
1
0
Originally posted by: Nothinman
cygwin can be significantly slower than normal operations in Windows though, I would take it's results as gospel.

If you install the Windows PowerShell (really, really gay name) you can use 'measure-command {copy source dest}' in there.
This what you're referring to?

http://www.microsoft.com/windowsserver2...ies/management/powershell/default.mspx

That might be the easiest way to do it in the short term. In the long term I might write a C++ program or something

I'll give these all a look, thanks guys