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

Batch file to copy file contents to another server

Status
Not open for further replies.

Boman

MIS
Jun 19, 2002
4
US
Two things, firstly I need to copy a backup file from one server to another in the same domain. The file resides on Server1 in d:\folder1\hsi\data\backup. The file name is gams1
I want to copy the file to another server called server2 with the same directory structure d:\folder1\hsi\data\backup.

i.e.
cd d:\folder1\hsi\data\backup
copy gams1bu \\server2\d:\folder1\hsi\data\backup
Secondly, I need to copy a directory and all subdirectories from Server1 to Server2 while maintaining all permissions.
Any help will be appreciated
 
Hi

The easiest way to copy from on to the other would be to share the folder on server2 (say as backup) and then do a batch file as below:

net use z: \\server2\backup
cd d:\folder1\hsi\data\backup
copy gams1bu z:
net use /delete z:

I am assuming here that you did share the folder as backup. If not then you will need to change the name on the first line only.

This could easily be amended to achieve your second task (I think). You might want to try it and then check that the permissions have been kept before just letting it get on with it.

Hope this helps

[lightsaber] May The Force Be With You [trooper] [yoda]
 
I use Robocopy (a tool from the Resource kit but also available free from other locations on the net)

Easy setup, works well and is solid
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top