.ftp files

how to run .ftp file in AIX... the code contains somefile.ftp---->

$cat somefile.ftp

open <ip>
user <username> <pwd>
put <source of filename >  <destination of file>

....

it is giving error.
can anybody help plzh

It it's just a file containing FTP commands, you could likely just 'pipe' it into FTP.

$ cat somefile.ftp | ftp

Perhaps neater to remove the cat:-

ftp -ivn < somefile.ftp > $ftplogfile 2>&1

The flags are:-

  • -n Not prompting (for user credentials, server, etc.)
  • -i disable interactive (i.e. it won't prompt if you mget *)
  • -v verbose output so you can see what's going on

Make sure you have a quit at the end of your somefile.ftp, just to be neat. Some FTP clients may loop waiting for input if you don't explicitly close them.

You can then read the log files back to check that the process has run correctly.

I hope that this helps,
Robin
Liverpool/Blackburn
UK

1 Like