Solved

How to auto copy files between Windows servers?

Posted on 2006-11-30
8
1,672 Views
Last Modified: 2008-02-07
There is plain text file on server A, which is updated serveral times every day. There is a SQL Server scheduled job on server B reads the text file and populates the database. Both servers are running Windows. Now the schedule job fails to read the text file on the other server and the error message says "access denied".

What I want to do is to copy the plain text file from server A to server B automatcially. Is there a way to do this in batch file?? Thank you for your help!  
0
Comment
Question by:iLvChopin
  • 3
  • 2
8 Comments
 
LVL 18

Expert Comment

by:Sam Panwar
Comment Utility
Hi iLvChopin,

If you want to copy text file from A serve to B server then you have to create VPN to connect both server so A server connect to B server. Access denied means you have not permission on that computer so please create VPN through the ROUTING AND REMOTE ACCESS and after that run schedule your problem should be resolve.

-ABS
0
 

Author Comment

by:iLvChopin
Comment Utility
The sql scheduled job on B server is running under the admin account which also has full access to A server. I don't understand why the access is denied when the scheduled job tries to read the text file.

Is there a way to copy the text file from server A to server B using batch commands? Something like:

@echo off
copy c:/text.csv@ServerA c:/docs@ServerB
0
 
LVL 18

Expert Comment

by:Sam Panwar
Comment Utility
Hi,

You can use xcopy for it is best.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 18

Accepted Solution

by:
Sam Panwar earned 125 total points
Comment Utility
Hi Abs_jaipur,
You can use XCOPY for it . Its best way to copy file, we  are also usinf this.

Create a .bat file for xcopy command through the notepad and put in to schedule
xcopy help
http://www.computerhope.com/xcopyhlp.htm#03

If you all access then create VPN its best way if you get permission access denied. Or map drive.


-ABS
0
 

Author Comment

by:iLvChopin
Comment Utility
thanks and i will try the above options. Will give you an update later. thanks.
0
 
LVL 1

Assisted Solution

by:hubtech
hubtech earned 125 total points
Comment Utility
I would suspect that the read access error may have been caused by the process that writes to the file having it locked.  I suggest that you want to initiate the batch file to copy the text file when the update process completes.  You can use a 'net use' command in a batch script to map a drive on the destination system and then copy the file over.  Here's an example:

  net use M: \\<computer\share> /persistent: no
  copy \srcdir\textfile.txt M:\destdir\textfile.txt

You can specify connection credentials if you need to on the 'net use' command line with the /USER switch.

Also try this for more information on mapping a drive from the command line (or batch script):

  net use /?

... hubtech
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

8 Experts available now in Live!

Get 1:1 Help Now