Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Automate FTP transfer from W2K3 - UNIX

Thread Tools
 
Search this Thread
 
Old 12 May 2005, 01:39 PM
  #1  
darlodge
Scooby Regular
Thread Starter
 
darlodge's Avatar
 
Join Date: Oct 2001
Location: Lovely Lancing in West Sussex
Posts: 3,449
Likes: 0
Received 0 Likes on 0 Posts
Default 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
Old 12 May 2005, 01:47 PM
  #2  
Vonzack
Scooby Regular
 
Vonzack's Avatar
 
Join Date: Jan 2004
Posts: 179
Likes: 0
Received 0 Likes on 0 Posts
Default

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>
Old 12 May 2005, 02:59 PM
  #3  
ChrisB
Moderator
 
ChrisB's Avatar
 
Join Date: Dec 1998
Location: Staffs
Posts: 23,573
Likes: 0
Received 0 Likes on 0 Posts
Default

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.
Old 12 May 2005, 04:07 PM
  #4  
darlodge
Scooby Regular
Thread Starter
 
darlodge's Avatar
 
Join Date: Oct 2001
Location: Lovely Lancing in West Sussex
Posts: 3,449
Likes: 0
Received 0 Likes on 0 Posts
Default

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
Old 16 May 2005, 01:16 PM
  #5  
Vonzack
Scooby Regular
 
Vonzack's Avatar
 
Join Date: Jan 2004
Posts: 179
Likes: 0
Received 0 Likes on 0 Posts
Default

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.
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
Wish
Computer & Technology Related
3
30 September 2015 10:39 PM
Littleted
Computer & Technology Related
4
25 September 2015 09:55 PM
alcazar
Non Scooby Related
5
18 September 2015 11:49 PM
mazbow
ScoobyNet General
2
15 September 2015 06:58 PM
AWD
Non Scooby Related
3
01 March 2001 11:31 AM



Quick Reply: Automate FTP transfer from W2K3 - UNIX



All times are GMT +1. The time now is 09:43 PM.