Office server => laptop =>client server ...a lengthy and laborious ftp procedure

Hi All,

I need your expertise in finding a way to solve my problem.Please excuse if this is not the right forum to ask this question and guide me to the correct forum,if possible.

I am a DBA and on a daily basis i have to ftp huge dump files from my company server to my laptop and then transfer these to client servers to import these into the database over there.This has become a laborious task and frustrating , as I get the requests in the middle of the night also.

How I do it.

  1. Using command prompt of windows i ftp the files to my laptop

  2. Using the same ftp i transfer these to client server.

I have to do this because there is no direct connectivity from office servers to the client servers due to firewall restrictions.

Can you help me automate this process( of step 1 and step2)? Or guide me to the post if this has been already discussed.

Regds,
Kunwar

There's some ideas for a MSDOS Batch File to automate ftp in this post.

http://www.unix.com/shell-programming-scripting/111088-how-ftp-file-local-folder-unix-server.html

We can take this idea a lot further but if the filenames are always the same a Batch File is a straightforward method for a repetitive task.
You don't mention Operating System versions or the actual file sizes but if we assume that the existing process works then it must be possible to automate that task.

1 Like

Thanks methyl. I am able to transfer files using the method given in the link. But the thing is that the filenames to be transferred are of different name always.

So can you help me automate it? I have come to know that we can pass parameter to a .bat file using % parameter .But i dont know batch scripting.
I am not getting how to implement it in the .bat file.

PFB the details you asked:

  1. Office server: SunOs
  2. Laptop: Windows XP Service Pack 3
  3. Client server: SunOs

File sizes can vary from few MBs to few GBs(<10GB).

Within a Batch File for example.

set FILE_NAME=%1
You can then refer to the variable
echo %FILE_NAME%

Here is an example of providing four variables, creating a FTP input file, and then executing the lot. In a live environment think carefully about holding passwords in flat files.

REM ftptest.bat
REM parameter driven with autologin

set X_FILE=%1
set X_USER=%2
set X_PASS=%3
set X_SERV=%4

echo %X_FILE% %X_USER% %X_PASS% %X_SERV%

echo user %X_USER% %X_PASS% > ftptest.inp
echo ascii >> ftptest.inp
echo get %X_FILE% >> ftptest.inp
echo quit >> ftptest.inp

ftp -n -s:ftptest.inp %X_SERV%