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
# 15  
Old 07-13-2006
This script run via autosys

#
HOST="machine"
IDPASSWORD="maichine.in"
LOCALDIR="lcd /xxxx/temp/"
EMAILNAMES="person's e-mail address"
LOCALMACHINE="local machine"
HOSTDIR="cd /tmp/"
TRANSFERTYPE=""
TRANSFERFUNCTION="put"
CHECKNAME=""
CHMOD="chmod 775"
FILENAME1="filename.txt"
LIST=
VENDOR=""


######################################################################
dt=`date '+%Y%m%d_%H%M'`
TMPDIR=/home/autosys/FTPlog
LOGDIR=/home/autosys/FTPlog
TMPFILE1=${TMPDIR}/`basename $0`.tmp1
TMPFILE2=${TMPDIR}/`basename $0`.tmp2
ERRFILE=${LOGDIR}/${AUTO_JOB_NAME:-`basename $0`}.err
LOGFILE=${LOGDIR}/${AUTO_JOB_NAME:-`basename $0`}.log
JOBNAME=${AUTO_JOB_NAME:-`basename $0`}
############################
#initalize log files, also done in autosys job Definition with std_out_file
cat /dev/null >${LOGFILE}
cat /dev/null >${ERRFILE}
###################################
DATE=`date +%m"/"%d"/"%y`

#
#Subroutine email_msg
#Arguements $1 - Message to send in email
#Description Send message in email
email_msg()
{
MAIL_TO_SUCC="$EMAILNAMES"
print "To:$MAIL_TO_SUCC\nSubject: $1 - $JOBNAME" | /usr/lib/sendmail -t

}

#Subroutine log_msg
#Arguements $1 - Message to write in log
#Description Write message to log file
log_msg()
{
echo "`date +'%b %d %H:%M:%S '`${HOST} $0[$$]: ${1}" >> ${LOGFILE}
}

log_msg "$0 started"

#
print "$LOCALMACHINE $JOBNAME THIS IS THE DATE=$DATE" >>${LOGFILE}

echo 'BEGINNING FTP ROUTINE...'
cat /idpass/$IDPASSWORD >$HOME/.netrc 2>> ${LOGFILE}
echo "open $HOST">${LOGDIR}/t
echo "$TRANSFERTYPE">>${LOGDIR}/t
echo "$HOSTDIR">>${LOGDIR}/t
echo "$LOCALDIR">>${LOGDIR}/t
echo "ls $LIST">>${LOGDIR}/t
echo "$TRANSFERFUNCTION $FILENAME1">>${LOGDIR}/t
echo "$CHMOD $FILENAME1">>${LOGDIR}/t
echo "ls $LIST">>${LOGDIR}/t
echo "quit" >>${LOGDIR}/t
echo "bye" >>${LOGDIR}/t
echo "" >>${LOGDIR}/t
ftp -ivd < ${LOGDIR}/t >>${LOGFILE} 2>${LOGFILE}
echo 'FTP ROUTINE HAS ENDED...'
cat /dev/null>$HOME/.netrc

I have condition checks after this

results:
Connected to machine.
220 machine FTP server (Version 1.1.214.7 Thu Aug 10 09:57:38 GMT 2000) ready.
---> USER xxxxx
331 Password required for xxxx.
---> PASS XXXXXX
230 User xxxx logged in.
---> SYST
215 UNIX Type: L8
Remote system type is UNIX.
---> TYPE I
200 Type set to I.
Using binary mode to transfer files.
---> CWD /tmp/
250 CWD command successful.
Local directory now /xxxx/temp/
---> PORT xxx.xxx.xxx.xxx,188
200 PORT command successful.
---> TYPE A
200 Type set to A.
---> LIST *
150 Opening ASCII mode data connection for /usr/bin/ls.
-rwxrwxr-x 1 xxxxx xxxxx_sys 1003779 Jun 15 09:48 filename.txt
226 Transfer complete.
# 16  
Old 12-05-2006
Unix to Windows professional

I wanted to register to this forum to introduce myself. My name is Joe Clark. I am a recruiter with TEKsystems in Illinois. We are a nationwide IT solutions company.

I am always looking for solid IT professionals who work in a Unix environment. Currently, I am working on a Unix to Windows migration position. I am having a difficult time finding qualified candidates. If anyone is interested, or knows of anyone who may be interested in this position, please let me know via email or telephone. My number is 847-632-9229. My email is eaclark@teksystems.com

If anyone is looking for new opportunities in the IT field, please let me know.
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