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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

just want to copy a folder

Status
Not open for further replies.

Ravenrx7

IS-IT--Management
Aug 21, 2002
109
US
Hello there,

bascially here it is, i just want to copy a shared folder from a server onto the user's desktop, sub directories and all. I've tried batch files using the XCOPY command and it's just not working, any suggestions?

Josh McMahon
A+ Certified,CCNA
sold@joshmcmahon.com
 

Use My.Computer.FileSystem.CopyDirectory(...) method to copy directories if you are using .NET 2.0.

The following example copies the directory TestDirectory_A into TestDirectory_B, overwriting existing files.

Code:
My.Computer.FileSystem.CopyDirectory("C:\TestDirectory_A", "C:\TestDirectory_B", True)

Set the last argument to False, if you do not want to overwrite.
 
the folder is on the network, exmaple \\waps-dc1 to local profile\desktop

Josh McMahon
A+ Certified,CCNA
sold@joshmcmahon.com
 

My.Computer.FileSystem.CopyDirectory(...) method should work properly on shared drives.

Code:
My.Computer.FileSystem.CopyDirectory("\\waps-dc1\myFolder", "\\waps-dc2\myBackupFolder", True)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top