Forum Moderators: phranque

Message Too Old, No Replies

Transfering text files between servers

Looking for somecode.

         

aspdaddy

9:43 am on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi what are the options to script the transfer of a text file from one ip to another under windows.

I was thinking I'l use a batch file or vbscript in the windows scheduler, running each night, but whats the commands for file transfer does it need to use ftp ports? Id rather not enable ftp if theres a better way, anyone have any code examples of this kind of thing, thx.

lammert

1:01 pm on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Were you thinking of "copy \\server1\share1\directory1\file1 \\server2\share2\directory2\file2"?

With FTP, create a batchfile which contains:

ftp -n -i -s:c:\path\putfile.ftp otherserver.ip

Now create a putfile.ftp containing

user username password
cd destination-path
ascii
mput yourfile
quit

aspdaddy

1:27 pm on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for that, I'l try the copy inside a vpn, else ill use the ftp, both servers are on public ips so I should be abble to make a restricted ftp rule on the fw.
Thanks.

pmkpmk

1:27 pm on Sep 5, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



man rsync
man wget

aspdaddy

8:30 am on Sep 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks guys, sorted now. I figured out how to do it without opening ftp ports on the local server and only need the port 21 open on the web server for one ip, just for a 15 min window each day.


Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run ("ftp -s:" & chr(34) & "C:\Imports\FTPScript.txt")
Set objShell = Nothing
/* ftp script */
open xx.#*$!.xx.xx
TheUser
ThePass
ascii
cd exports
lcd c:\imports
get DailyExport.csv
bye