Sponsored Content
Top Forums Shell Programming and Scripting shell script to transfer files from Unix to Windows Post 302079798 by amon on Thursday 13th of July 2006 02:20:50 AM
Old 07-13-2006
OK I am posting whole script...

on UNIX:
ftpscript:

#!/bin/ksh
#Usage example: ftpscript readme.txt /pub/dir1/readme.txt
localFile=$1
remoteFile=$2


ftplog=loglog.log
echo "$(date "+%H:%M:%S") - Attempt to FTP $1 to $2" > $ftplog

# do the FTP put

ftp -i -n <<EOF >> $ftplog
open <hereIPaddress>
user someuser somepass
put $localFile $remoteFile
ls $remoteFile
quit
EOF


./ftpscript localfile.txt
so by entering IP of my windows machine and execution of this script file goes to windows...and this works..but file goes to my directory I specified in IIS I was wondering can I tell in UNIX script where to place file when it is transfer from U. to W.??

Thanks for answers..
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
FTP_FGET(3)								 1							       FTP_FGET(3)

ftp_fget - Downloads a file from the FTP server and saves to an open file

SYNOPSIS
bool ftp_fget (resource $ftp_stream, resource $handle, string $remote_file, int $mode, [int $resumepos]) DESCRIPTION
ftp_fget(3) retrieves $remote_file from the FTP server, and writes it to the given file pointer. PARAMETERS
o $ftp_stream - The link identifier of the FTP connection. o $handle - An open file pointer in which we store the data. o $remote_file - The remote file path. o $mode - The transfer mode. Must be either FTP_ASCII or FTP_BINARY. o $resumepos - The position in the remote file to start downloading from. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 ftp_fget(3) example <?php // path to remote file $remote_file = 'somefile.txt'; $local_file = 'localfile.txt'; // open some file to write to $handle = fopen($local_file, 'w'); // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // try to download $remote_file and save it to $handle if (ftp_fget($conn_id, $handle, $remote_file, FTP_ASCII, 0)) { echo "successfully written to $local_file "; } else { echo "There was a problem while downloading $remote_file to $local_file "; } // close the connection and the file handler ftp_close($conn_id); fclose($handle); ?> SEE ALSO
ftp_get(3), ftp_nb_get(3), ftp_nb_fget(3). PHP Documentation Group FTP_FGET(3)
All times are GMT -4. The time now is 11:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy