Solved

How to auto copy files between Windows servers?

Posted on 2006-11-30
8
1,678 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
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…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

815 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

13 Experts available now in Live!

Get 1:1 Help Now