Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-08-2009
Registered User
 

Join Date: Apr 2009
Posts: 17
shell script to ftp the files from windows to unix server

Hi,
I need to ftp some input files from windows to unix server.All the files will be saved in the C drive in my machine.
Currently all these files are transferring manually to the unix server.I need to write a shell script which ftp the files
from windows to unix box.When I searched in the forum i got the below mentioned script to ftp the files.It works fine when i
ftp the files from one unix server to another unix server.But it is not working when i tried from Windows to unix .I am getting the below mentioned error message.can anybody help me on this?

Code:

HOST=111.212.242.233
PASSWORD=xxxx
USER=kk1234
FILE_NAME=test1.dat
ftp -v -n ${HOST} << cmd
user ${USER} ${PASSWORD}
cd /home/kkk/test/
lcd C:\Documents and Settings\Folder1get ssh_install
ls ${FILE_NAME}
get ${FILE_NAME}
quit
cmd

ERROR MESSAGE
-------------------

Code:

ftp: connect: Connection timed out
Not connected.
Not connected.
usage:lcd local-directory


Last edited by Franklin52; 10-08-2009 at 04:50 AM.. Reason: Please use code tags!
Sponsored Links
  #2 (permalink)  
Old 10-08-2009
zaxxon's Avatar
zaxxon zaxxon is offline Forum Staff  
Moderator
 

Join Date: Sep 2007
Location: Germany
Posts: 2,656
Quote:
ftp: connect: Connection timed out
Either the IP is wrong, the host is not up or there is no ftp demon running on the default ftp port 21.
Maybe try to ping 1st, check with nmap if the port 21 is open and also check if you can manually connect with a ftp client to the ftp demon.
  #3 (permalink)  
Old 10-08-2009
Registered User
 

Join Date: Mar 2008
Posts: 1,609
The usage error is because of the space in the directory name.
But ... "cd" refers to the remote (Windows) server and "lcd" refers to the local (unix) server.

Quote:
cd /home/kkk/test/
lcd C:\Documents and Settings\Folder1get ssh_install
Surely you mean:


Code:

cd "C:\Documents and Settings\Folder1get ssh_install"
lcd /home/kkk/test/

  #4 (permalink)  
Old 10-09-2009
Registered User
 

Join Date: Apr 2009
Posts: 17
Thanks Methyl the error with lcd has gone now.
Zaxxon,
Thanks for your suggestion
The ip address which I have given is my machine ip and it is up.I can connect from my WINDOWS dos prompt to the unix server and do the ftp process sucessfully.This error i recieve only when itry to connect to the machine ip from the unix server by using the command ftp -v -n 111.212.242.233

Regards
  #5 (permalink)  
Old 10-09-2009
Registered User
 

Join Date: Mar 2008
Posts: 1,609
Sounds like you have not started the FTP listener service on the Windows server ... or the Windows firewall is running with FTP blocked.
On the Windows server, can you ftp to yourself? If you can't do that there is no chance from the outside.

Code:

ftp localhost
ftp 111.212.242.233

  #6 (permalink)  
Old 10-12-2009
Registered User
 

Join Date: Apr 2009
Posts: 17
I tried this in the command prompt but i could not able to login with my password.How can I prevent the windows firewall blocking the FTP server?. Currently WinScp client has installed in my machine.Do i need to install some software like File Zilla server to try this ?Kindly Please guide me on this.
  #7 (permalink)  
Old 10-12-2009
Registered User
 

Join Date: Mar 2008
Posts: 1,609
What exact version of Windows are you running?
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
FTPing files from unix server to windows server venkatesht Shell Programming and Scripting 1 04-28-2009 10:54 AM
Script runs fine on UNIX Server...Not through MSK Tool kit on Windows Server madhunk UNIX for Dummies Questions & Answers 5 01-31-2008 01:30 PM
Shell Script to ftp from windows server shilpa.rajput Shell Programming and Scripting 8 11-07-2007 12:52 AM
shell script to transfer files from Unix to Windows knag Shell Programming and Scripting 15 12-05-2006 05:46 PM
Unix Sco Open Server, Windows Computers Problem Access Unix Shared Files Help!!!!! haggo Filesystems, Disks and Memory 2 08-23-2006 12:39 PM



All times are GMT -4. The time now is 03:39 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0