Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FIleCopy command 1

Status
Not open for further replies.

lamaar

Technical User
Jun 29, 2000
392
GB
I am very new to VB an wondered if someone could point me in the right direction.

I am wanting to copy a file from one server to another. I have used to following code (rightly/wrongly). Can someone tell me where I went wrong.

Dim SourceFile, DestinationFile
SourceFile = "Server\folder\filename.txt"
DestinationFile = "Server2\Folder\filename.txt"
FileCopy SourceFile, DestinationFile

Any help will be grateful. Also, if the file already exists on Server2, I would want it to copy over it.

Thanks Lamaar75@hotmail.com
 
Try the following:
FileCopy "\\server\folder\file.txt", "\\server2\folder\file.txt"

This will overwrite a currently existing file on server2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top