shell script to transfer files from Unix to Windows


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting shell script to transfer files from Unix to Windows
# 1  
Old 07-11-2006
shell script to transfer files from Unix to Windows

I need to write a shell script to transfer files from Unix server to windows machine. This script will be scheduled on scheduler to run at specified intervals

#!/bin/ksh
ftp -n alaska <<End-Of-Session
user sss01 sample
cd /home/sss01
lcd D:/sample
mget *.txt
bye

when I executed the above shell script. It throws error saying file location D:/sample not found.
Can somebody please help me in writing the script?
# 2  
Old 07-11-2006
Quote:
Originally Posted by knag
I need to write a shell script to transfer files from Unix server to windows machine. This script will be scheduled on scheduler to run at specified intervals

#!/bin/ksh
ftp -n alaska <<End-Of-Session
user sss01 sample
cd /home/sss01
lcd D:/sample
mget *.txt
bye

when I executed the above shell script. It throws error saying file location D:/sample not found.
Can somebody please help me in writing the script?
You code should contain the terminating here-document End-Of-Session

Code:
#!/bin/ksh
ftp -n alaska <<End-Of-Session
user sss01 sample
cd /home/sss01
lcd D:/sample
mget *.txt
bye
End-Of-Session

# 3  
Old 07-11-2006
Hi Vino,

Thanks for you reply!
I added the EOF statement at the end. Now the session the coming out of ftp. but the error 'D:/Nagaraj: No such file or directory' still exists
can you please help..
# 4  
Old 07-11-2006
Quote:
Originally Posted by knag
Hi Vino,

Thanks for you reply!
I added the EOF statement at the end. Now the session the coming out of ftp. but the error 'D:/Nagaraj: No such file or directory' still exists
can you please help..
Hmmm... Drop the ':' to make it D/Nagaraj
# 5  
Old 07-11-2006
It's complaining about the "lcd" command, telling the local system (that's running the FTP script) to change directory (as opposed to changing the directory on the FTP server.)

That looks like a Windows path to me (D:\sample). But your script is calling /bin/ksh. Are you on a Windows box, a Unix box, or a Windows box with SFU or Cygwin installed?
# 6  
Old 07-12-2006
I created also script to transfer file from UNIX to WIn.but I had to set up ftp directory in windows(IIS) so I can just put my files in that directory..

I would also love to see is it possible to use lcd command so I could change windows directory in my unix script???

It that possible??
# 7  
Old 07-12-2006
How do i issue an command via FTP to an AS400 from an unix platform

Help
How do i issue an command via FTP to an AS400 from an unix platform? Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with a script to transfer files from Solaris to windows

Hi Please can you tell me what could be wrong with the following scriptto transfer files from solaris 10 to windows machine: #!/bin/sh HOST=<IP> USER=administrator PASSWD=xyz123zyx /usr/bin/ftp -inv <<EOF connect $HOST user $USER $PASSWD cd Documents binary mput *.sh bye EOF (23 Replies)
Discussion started by: fretagi
23 Replies

2. Shell Programming and Scripting

Script to transfer files from Solaris to windows

Hi All Please can you help, I´ve wrote the following script on a solaris 10 server to transfer files to a windows machine. #!/usr/bin/sh cd /moneta_polled01/download HOST=10.100.4.72 USER=user1 PASSWD=V7stop /usr/bin/ftp -v $HOST <<EOF user $USER $PASSWD cd tmp binary put... (7 Replies)
Discussion started by: fretagi
7 Replies

3. Windows & DOS: Issues & Discussions

Cygwin script to transfer file from windows to UNIX

Hi, Objective is to transfer files from windows server to Unix server using cygwin. I have installed cygwin, and I manually execute commands and transfer files from windows to unix using sftp. These are steps I execute 1) Run cmd 2) Run cygwin 3) At prompt type sftp user1@uniserver 4) lcd... (2 Replies)
Discussion started by: wahi80
2 Replies

4. Shell Programming and Scripting

Unix shell script to delete files on windows server

Hi experts, can anyone suggest me on the below: how to write a shell script to search and delete files on windows server. -script runs on unix box -it should search for specific files on windows server and delete them periodically. (2 Replies)
Discussion started by: chpradeepch
2 Replies

5. Shell Programming and Scripting

Shell Script to transfer files from unix to windows

I have to transfer a file from unix to windows through Shell Script. I am using the below script, but it is not working. Please help. Please note --- I have to transfer the file from unix to windows. Not from windows to unix. I mean I don't have to use batch script.Only through unix shell script.... (1 Reply)
Discussion started by: vsachan
1 Replies

6. Shell Programming and Scripting

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... (10 Replies)
Discussion started by: kavithakuttyk
10 Replies

7. UNIX for Advanced & Expert Users

Shell script to ftp files from windows to unix

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... (1 Reply)
Discussion started by: kavithakuttyk
1 Replies

8. UNIX for Advanced & Expert Users

How to transfer files from Unix to Windows.

Hi There is a requirement for me to transfer files from Unix to windows in an automation process of unix. Please let me know is it posibble to shell scripting this? Could you help me in scripting it? Regards Venugopal (2 Replies)
Discussion started by: venu_eie
2 Replies

9. UNIX for Dummies Questions & Answers

Transfer files from Unix server to Windows using FTP

Dear Friend, I don't know much about unix.I am an VB6.0 Programmer.I need to move an text files as aaa.txt from unix server to windows "D: " driver using the FTP protocol.Is it possible to do this with help of unix shell script.If possible please give some sample codes. Please answer as early... (1 Reply)
Discussion started by: gjsaravanan
1 Replies

10. Shell Programming and Scripting

transfer of files via ftp from windows to unix

I am currently looking to write a script to transfer files from a windows NT server to a unix server any ideas of how to go about this? (1 Reply)
Discussion started by: chambala5
1 Replies
Login or Register to Ask a Question