Automate FTP transfer from W2K3 - UNIX
#1
Scooby Regular
Thread Starter
Join Date: Oct 2001
Location: Lovely Lancing in West Sussex
Posts: 3,449
Likes: 0
Received 0 Likes
on
0 Posts
Automate FTP transfer from W2K3 - UNIX
I need to get a file from a Windows Server to a UNIX server everyday via FTP (or SFTP). I want the process automated fully so what would you suggest?
1. Install some software on the server (w2k3) that allows linking network drives as FTP areas and use a batch file to copy at set times of the day (via Scheduled Tasks)
2. Install something like Auto FTP Manager to automate the process for us
3. Script it all
Has anyone done something like this before?
Dazza
1. Install some software on the server (w2k3) that allows linking network drives as FTP areas and use a batch file to copy at set times of the day (via Scheduled Tasks)
2. Install something like Auto FTP Manager to automate the process for us
3. Script it all
Has anyone done something like this before?
Dazza
#2
You can do it using the standard FTP command and the windows scheduler.
Create an FTP script that logs in, connects to your unix server, pushes the file, then disconnects as in:
prompt
lcd <where your send file is>
open <unix server>
user <user> <password>
cd <where your target is>
put <filename>
close
bye
Then call it from the windows scheduler as "ftp -n -s:<script name>
Create an FTP script that logs in, connects to your unix server, pushes the file, then disconnects as in:
prompt
lcd <where your send file is>
open <unix server>
user <user> <password>
cd <where your target is>
put <filename>
close
bye
Then call it from the windows scheduler as "ftp -n -s:<script name>
#3
As a live example of what Vonzack suggests, this is my script to get a DAT file from the NAI site:
Batch file:
E:
Cd\source\Anti-virus\NAI\DATUpdates
Del update.ini
ftp -s:sdat_ftp_cmds.txt
The txt file being:
open ftp.nai.com
anonymous
anonymous@anonymous.net
prompt off
bin
cd /pub/antivirus/datfiles/4.x/
mget *.zip
mget update.ini
quit
HTH,
Chris.
Batch file:
E:
Cd\source\Anti-virus\NAI\DATUpdates
Del update.ini
ftp -s:sdat_ftp_cmds.txt
The txt file being:
open ftp.nai.com
anonymous
anonymous@anonymous.net
prompt off
bin
cd /pub/antivirus/datfiles/4.x/
mget *.zip
mget update.ini
quit
HTH,
Chris.
#4
Scooby Regular
Thread Starter
Join Date: Oct 2001
Location: Lovely Lancing in West Sussex
Posts: 3,449
Likes: 0
Received 0 Likes
on
0 Posts
Cheers guys,
I ended up writing in the the end.
o xxx.xxx.xxx.xxx
user user password
cd ..
cd ..
cd tmp
put h:\Addacs\ADDACS0.txt ADDACS0.txt
put h:\Addacs\ADDACS1.txt ADDACS1.txt
close
bye
It works a treat, however is it possible to delete the files held on h:\addacs?
The delete command only looks like it deletes files on the remote server.
I need to delete the files after they have copied so I may ave to have a second script to run a del command to delete the 2 files.
Darren
I ended up writing in the the end.
o xxx.xxx.xxx.xxx
user user password
cd ..
cd ..
cd tmp
put h:\Addacs\ADDACS0.txt ADDACS0.txt
put h:\Addacs\ADDACS1.txt ADDACS1.txt
close
bye
It works a treat, however is it possible to delete the files held on h:\addacs?
The delete command only looks like it deletes files on the remote server.
I need to delete the files after they have copied so I may ave to have a second script to run a del command to delete the 2 files.
Darren
#5
Hi darlodge,
When your FTP session is open you can use the ! character to shell out to cmd. Put a "!del <file>" line after each of your puts, to remove the file after transfer.
put h:\Addacs\ADDACS0.txt ADDACS0.txt
!del h:\Addacs\ADDACS0.txt
Cheers.
When your FTP session is open you can use the ! character to shell out to cmd. Put a "!del <file>" line after each of your puts, to remove the file after transfer.
put h:\Addacs\ADDACS0.txt ADDACS0.txt
!del h:\Addacs\ADDACS0.txt
Cheers.
Thread
Thread Starter
Forum
Replies
Last Post
alcazar
Non Scooby Related
5
18 September 2015 11:49 PM