Link to home
Start Free TrialLog in
Avatar of raaj4354
raaj4354

asked on

Script to FTP files

Need a script to FTP directories  from AIX box to windows. Both are at remote  locations.Has to keep the sub directories folder structure intact. Rsync and cygwin installed on windows.
ASKER CERTIFIED SOLUTION
Avatar of Carl Dula
Carl Dula
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bill Prew
Bill Prew

So, do you want to run the script on the unix machine and "push" the files, or do you want to run it on the windows machine and "pull" the files?

~bp
Avatar of raaj4354

ASKER

carl: I executed the script above. seems to be a connectivity issue..
remote host refused an connection operation
rsync: connection unexpectedly  closed (o bytes transferred so far)
rsync error:error in rsync protocol data stream code (12) at io.c (600) ..any ideas..

Also  can the remote path on windows can be C:/some dir/..?


billprew:
I dont mind doing it either ways as long as it ftps the directories with all the files in it.
Ok, the issue is a login one.

rsync is configured to use ssh by default so lets replacing the line form above with this...

rsync --delete  -av * [user@]host::module/path/.
(the name/path you are putting in here is the same as you would to remote acceses a share)

This assumes you have ssh on the remote system.

This is detailed in the "-e" section of the doc at http://rsync.samba.org/ftp/rsync/rsync.html
Can the FTP done to a specific folder on windows rather than a shared folder. The script is failing since it not find the directory..!
Set up a top level share on the target system such as..
          myshare = \mycomputer\folder\folder2
and reference myshare in the login

You must have permission to log into the target system, and to write to the place where you want to put the file.
The files are being ftped out from the AIX when i see the log but i cant see the files on the windows side..!! Sorry for the late response.
My guess is that the share is not correct, or you are not using it.

Make a dummy file with some name that is unique. ftp that to the windows system and then search for it. That will tell you where they are going.
I made a dummy directory and executed  the script and I see the list of files that are uploading. My share folder is /new and in the script i gave /new/new1 and the log shows me "creating new directory /newnew1/ .  I searched the computer for folder newnew1 nothing found...
Just search for new1
#!/bin/ksh

COMO=/home/user/rsync_log.`date +%d%h%y.%H:%M`
date | tee -a ${COMO}
print "rsynci script" | tee -a ${COMO}

cd /usr/testdir/directory/subfolder/
rsync --delete -av * [user@]hostname:\new
print "completed `date`" | tee -a ${COMO}

print "Copy completed `date`" | tee -a ${COMO}
exit


I searched for directory name and the files that were transferred could not find any..:-(
I pinged the host to which i am trying ftp the files and it is reachable. Checked inside the shared folder no files ftped..
Just to be sure, you have replaced [user@]hostname with the real credentials that you would use to access that share?

like...

joe@192.168.1.10:/new