Link to home
Start Free TrialLog in
Avatar of LuckyLucks
LuckyLucks

asked on

Copying file from one server to another

Hi,

 I have the names of file path in a MS SQL 2005 table in the following format:

Path Filename
Myfileserver\ABC  abc.txt
Myfileserver\DBC  dbc1.txt

etc

These can be dumped into a flat file called processfiles.txt residing on the SQL server, which would contain the following contents:
Myfileserver\ABC\abc.txt
Myfileserver\DBC\dbc1.txt

I wanted to write a batch script that will reside on a different server than the SQL server and will need to copy those files in the table and put them on a folder on the current server.

How do I accomplish this?
Avatar of Don Thomson
Don Thomson
Flag of Canada image

something like this may work

for %%f in (Myfileserver\abc\*.txt) DO type %%f>>\\Otherfileserver\whateverfolder\processfiles.txt
do this for each folder
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LuckyLucks
LuckyLucks

ASKER

The problem is Myfileserver\ABC and Myfileserver\DBC etc are dynamically produced in the table. So prior to this question, there is a button thats presses, stuff happens and the table containing the two folder locations is created. It could  be a different number and name of folders the next time around. Each folder also may have a different number of files in it each time. Hence, any hardcoding is not going to work.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do the original files have to be deleted?
no originals have to be deleted
@LuckyLucas - any response to my previous post?