Solved

How to auto copy files between Windows servers?

Posted on 2006-11-30
8
1,675 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
ID: 18050886
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
ID: 18051104
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
ID: 18051314
Hi,

You can use xcopy for it is best.
0
Superior storage. Superior surveillance.

WD Purple drives are built for 24/7, always-on, high-definition security systems. With support for up to 8 hard drives and 32 cameras, WD Purple drives are optimized for surveillance.

 
LVL 18

Accepted Solution

by:
Sam Panwar earned 125 total points
ID: 18051482
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
ID: 18054073
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
ID: 18058760
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

947 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

23 Experts available now in Live!

Get 1:1 Help Now