未找到unix ftp transfer mget path

时间:2015-12-15 12:08:01

标签: unix ftp ksh

我使用下面的代码将文件从ftp机器传输到本地机器。我从本地机器运行此代码

   #check path exists in local 
   if [[ -d /ahome/data/tt/ftp ]] then
        print "$scriptname path exists" 1>&2;
    fi
    #output run.ksh  path exists

    #Create if path not exists in Local
    if [[ ! -d /ahome/data/tt/ftp ]] then
        print "$scriptname  /ftp not found.create" 1>&2;
        mkdir /ahome/data/tt/ftp
    fi  

    #transfer files from ftp.inf.com to local path
    ftp -i ftp.inf.com  << FTP_START
        cd /infhome/upload/tt
        mget new* /ahome/data/tt/ftp/
        bye
    FTP_START
    #error  /ahome/data/tt/ftp the system cannot find the path specified

由于该错误,它将文件复制到放置run.ksh的同一目录中。无法弄清楚原因。它是否正在检查其他地方的路径

1 个答案:

答案 0 :(得分:1)

发布Mark的评论中提到的答案。

get允许从ftp复制单个文件。语法如下

cd [remote dir]
get remote-file [local-file-with-path]

mget将多个文件从远程复制到本地。我们需要使用lcd命令

提及目标目录
cd [remote dir]
lcd [local dir]
mget fileprefix*

请参阅this链接