1751807 Members
4908 Online
108781 Solutions
New Discussion юеВ

Re: Unix ftp command

 
Dinesh Abrol
New Member

Unix ftp command

I am running a script on one Unix machine and need to transfer(ftp) directory & files from this unix machine to a Windows system.
The problem is how to create the directory structure on the Windows machine from within the script.
Actually the creation of directory structure on the windows machine is conditional.
How do i check whether a particular directory structure is existent on the windows machine within the ftp session.

Now in between how to check whether (say) "test" directory exists in the ftproot of the target machine..

I m using the following code:
{ echo "open $FTP_IP_ADDRESS
user $FTP_USER_NAME $FTP_PASSWORD"



} | ftp -v -i -n

If I substitute with the following code:
{ if [ -d test ] ; then echo " dir there " ; else echo "dir not" ; fi }

, then it says invalid command..

On the other hand if I substitute with the following code:
! { if [ -d test ] ; then echo " dir there " ; else echo "dir not" ; fi }

, then checks the local directory of the Unix machine.
Pls send your suggestions
Pls IGNORE the case where I can tar and zip the required directory structure to a file and then ftp that file to the target machine.
2 REPLIES 2
harry d brown jr
Honored Contributor

Re: Unix ftp command


You could use "rcp" on your windows box to PULL the files and directories. cd WINDOZE_PATH then rcp -brp HPUXhost:/path .

If you want conditional FTP'ing then I'd suggest you use perl. Look at Clay's response here:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=550649

live free or die
harry
Live Free or Die
Alexander M. Ermes
Honored Contributor

Re: Unix ftp command

Hi there.
Have you given it the complete path including the drive ?
like 'd:\test'

Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"