Operating System - HP-UX
1825768 Members
3152 Online
109687 Solutions
New Discussion

How to transfer files and its sub-directories through ftp

 
SOLVED
Go to solution
Becke
Super Advisor

How to transfer files and its sub-directories through ftp

Hi everyone,

I have written a korn shell automated script which only transfer files, but how do I transfer all the subdirectories in the filesystem.

Any help would be greatly appreciated. Below is my script.
#!/usr/bin/ksh
cd /FILESYSTEM_NAME
USER=root
PASS=1234
MACHINE=hostname
FTP=/usr/bin/ftp
$FTP -n $MACHINE </dev/null 2>$1
user $USER $PASS
ascii
cd /FILESYSTEM_NAME
mput *

The above script works fine, but what do i need to do in the script so it transfer all the files in the subdirectories of /FILESYSTEM_NAME. Please advise
15 REPLIES 15
KapilRaj
Honored Contributor
Solution

Re: How to transfer files and its sub-directories through ftp

Not possible but there are some ftp softwares available which can do this trick.

Else you may use scp or rcp for doing this

Regds,

Kaps
Nothing is impossible
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp


Thanks for your reply Kapil, I have set up rcp to transfer files and its been working O.K, however this morning when i tried running rcp command it failed with an error messgae "rcmd: primary connection shut down".

rcp command failed with the above error message. I have refreshed rpcd daemon but no difference...

My other query is, how to create a nfs connection b/w hp machines?

Thanks for your help
Naveej.K.A
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

Farhan,

You have to set up an NFS server, export the directories and set up an NFS client and mount the exported directories.

http://docs.hp.com/en/5991-1153/index.html

is the HP Documentation for setting up NFS server.

Regards,
Naveej
practice makes a man perfect!!!
Rajeev  Shukla
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

use ncftp, it very easy and can do lot more than normal ftp, you can get it from
http://hpux.connect.org.uk/hppd/hpux/Networking/FTP/ncftp-3.1.8/

Cheers
Rajeev
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Thanks mate, i will look into it, actually my expertise is AIX, I'm learning HP along the way...cheers
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Hi everyone,

Just need help, I have exported a filesystem with this command 'exportfs -i -o rw=hostname filesystem_name', now on the remote machine how do i mount this filesystem, as there is already a filesystem mounted with the same name on remote machine..

I suppose i can mount this exported filesystem somewhere else on the remote machine but what would be the appropriate command, please advise,

cheers,
Raf
Peter Godron
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

Farhan,
you can:
create new directory in /
mount -F :/ /
so for example:
if you want to mount directory fred from server test to directory ted on you machine
mkdir /ted
mount -F nfs test:/fred /ted

Please also have a look at :
man 1m mount
Regards
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Thanks mate its all sweet now, I have another query, I'm using rcp command from one HP server to another but its not working,the error message is "rcmd primary connection shut down", so how to do i start this rcmd or what needs to be done..please advise,

your help would be appreciated..cheers
Peter Godron
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

Farhan,
you have to be set up on the remote machine (see man rcp).
" The current local user name or any user name specified via ruser must exist on rhost and allow remote command execution via remsh(1) and rcmd(3N). remshd(1M) must be executable on the remote host."

Also see
http://forums1.itrc.hp.com/service/forums/helptips.do?#34
Regards
ooorichard
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

# Network File System (NFS)
# NFS-Server
vi /etc/rc.config.d/nfsconf
/sbin/init.d/nfs.server start
vi /etc/exports # zu exportierende FS spezifizieren
showmount -e; exportfs(; rpcinfo -p; nfsstat) # testing NFS
# NFS-Client
vi /etc/rc.config.d/nfsconf
/sbin/init.d/nfs.client start
mount :
vi /etc/fstab
showmount -e svr; rpcinfo -p [svr] # testing NFS

Re: How to transfer files and its sub-directories through ftp

Farhan,
If your sub directories are fixed, you can hard code those in your script, change directory and transfer file. Even, if the sub directories are not fixed you can get the name of those subdirectories and dynamically create your script. This should work.

In your script you have used mput*. Is it not prompting you before sending each file ?
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Thanks for everyone's response, I have mounted the nfs filesystem successfully, however when I do ls -l on the client machine it doesn't list the files in the filesystem. It seems like a permission problem, I have exported the filesystem with read and write option with the exportfs command, what else needs to be done so I can atleast see the contents of the exported filesystem on a client machine?

In relation to my second query, rcp works O.K sometimes but it doesn't work sometimes and fails with the an error message "rcmd: primary connection shut down", its all setup in the remote host's .rhost and hosts.equiv files, it just works sometimes and sometimes it doesn't.
I'm doing a bit of research on this but any help would be great on the above issues.

Cheers
Biswajit Tripathy
Honored Contributor

Re: How to transfer files and its sub-directories through ftp

Farhan wrote:
>I have exported the filesystem with read and write
> option with the exportfs command, what else needs
> to be done so I can atleast see the contents of the
> exported filesystem on a client machine?

Once you export the filesystem in the server, you
need to mount the filesystem in the client to be able
to see it. Easiest way to do this would be to run
SAM, go to "Networking And Communications" ->
"Networked Filesystem" -> "Mounted remote
file systems". Click on "Action" and "Add remote
filesystem".

- Biswajit
:-)
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Thanks for ur reply, I have already mounted that exported filesystem on a client machine and it has mounted it O.K but when I cd into it, i can't list the files?
Becke
Super Advisor

Re: How to transfer files and its sub-directories through ftp

Thanks guys, I have managed to resolve my NFS problem, there were some permission problems.

Cheers