Solved

move a file from one server to another server using a batch file

Posted on 2012-04-06
8
341 Views
Last Modified: 2012-04-10
Can anyone tell me how to move a file from one server to another server using a batch file?  I can move a file within the same server, but not able to move it to another server.
0
Comment
Question by:moni81011
  • 4
  • 3
8 Comments
 
LVL 17

Accepted Solution

by:
Anuroopsundd earned 400 total points
Comment Utility
just to simplify .. you can map the shared folder of 2nd server in your batch file then copy the file as you are doing it locally. after copy completed delete the shared folder drive

net use x: \\servername\sharename  password /USER:myAccount
copy c:\text.txt x:\
net use x: /delete
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
What have you tried that didn't work, and what was the error(s)?

~bp
0
 

Author Comment

by:moni81011
Comment Utility
Could we do it the other way around?  Could we place this .bat file on the server the file is going to and grab the file from the server it is coming from?

Thanks in advance.
0
 

Author Comment

by:moni81011
Comment Utility
What Anuroopsundd told me to do works, but I'm not exactly sure how to place the .bat file on our host as that is where the file resides.  So I wanted to see if there is a way to place the .bat file on the server the file is supposed to go to and what code needs to be changed in the .bat file.
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Should work the same way, just reverse the parms in the COPY, like:

net use x: \\servername\sharename  password /USER:myAccount
copy x:\text.txt c:\destdir
net use x: /delete

~bp
0
 

Author Comment

by:moni81011
Comment Utility
I'm not 100% sure how to make that work.  Ok, this is what I did the first time to make it work:

I got a file from my pc and placed it on the server using what Anuroopsundd provided like this:

net use x: \\servername\sharename path (2nd server-destination server)
copy C:\Users\path\filename x:\
net use x: /delete

and that works.

Now I want to be able to put the .bat file on the second server where the file should end up at and tell it to go to the host and grab this file and put it on this server.
If I just reverse the second line where it is copying the information, it is looking for the file on the second server, which it will never find cause it resides on the first server.
Do I make any sense? I hope I do.  :)
0
 
LVL 51

Assisted Solution

by:Bill Prew
Bill Prew earned 100 total points
Comment Utility
In the BAT file you put on the 2nd server, you will still specify the path from the first server in the line:

net use x: \\servername\sharename path

~bp
0
 

Author Comment

by:moni81011
Comment Utility
Thank you.  I tried that, but for some reason it does not work.  
Thank you for all your help.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

This article was inspired by a question here at Experts Exchange (http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/Q_28629170.html). The requirements stated in that question are (1) reduce the file size of a large number of…
I have published numerous articles here at Experts Exchange that present programs/scripts written in a language called AutoHotkey. Each of those articles has a brief paragraph describing where to download the product and how to install it. I have al…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now