unix ftp 未找到传输 mget 路径

unix ftp transfer mget path not found

我使用下面的代码将文件从 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 所在的同一目录。无法弄清楚为什么。它是否正在检查其他地方的路径

发布马克评论中提到的答案。

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

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

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

cd [remote dir]
lcd [local dir]
mget fileprefix*

参考thislink也