Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to auto copy files between Windows servers?

Posted on 2006-11-30
8
Medium Priority
?
1,690 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 18

Accepted Solution

by:
Sam Panwar earned 500 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 500 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

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…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

670 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