Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在将frm UNIX FTP到Windows时检查远程服务器上是否存在目录_Windows_Unix_Ftp - Fatal编程技术网

如何在将frm UNIX FTP到Windows时检查远程服务器上是否存在目录

如何在将frm UNIX FTP到Windows时检查远程服务器上是否存在目录,windows,unix,ftp,Windows,Unix,Ftp,我正在尝试将文件从UNIX服务器FTP到Windows服务器;在目前的塞纳里奥, 如果我的目标目录不存在,则它是默认目录下的文件 我对这种情况的修复方法是检查目录是否存在,然后通过FTP传输文件。只是我不知道如何实现相同的功能。PFA和建议 srcpath=/home/fcadmin/Repository_ftp_test/venx CS=/FCreportsrepository/Host SCR_PATH=/home/fcadmin/Repository_ftp_test/venx dpcp

我正在尝试将文件从UNIX服务器FTP到Windows服务器;在目前的塞纳里奥,

如果我的目标目录不存在,则它是默认目录下的文件

我对这种情况的修复方法是检查目录是否存在,然后通过FTP传输文件。只是我不知道如何实现相同的功能。PFA和建议

srcpath=/home/fcadmin/Repository_ftp_test/venx

CS=/FCreportsrepository/Host
SCR_PATH=/home/fcadmin/Repository_ftp_test/venx
dpcpath=/fchostrjs/fcprdapp/dpcreports
logpath=/fchostrjs/fcprdapp/dpclog


for j in `cat venx.txt`
do

ftp -i -n <<EOF>ftp_me.log
open 10.226.14.102
user ftpuser abc!123
binary on
prompt
cd $CS
lcd $srcpath 
if[<Directory Exists>];
then echo "Directory exists";
mput $j;
else
echo "Specified Directory doesnt Exist">>ftp_me.log;
exit;
fi
EOF

EXITFTP=$?
if test $EXITFTP -ne 0; 
then echo "$D ERROR FTP" >> $LOG;
exit ;
fi

if (grep "^Not connected." ftp_me.log); then echo "$D ERROR FTP CONNECT" >> $LOG; fi 
if (grep "No such file" ftp_me.log); then echo "$D ERROR FTP NO SUCH FILE" >> $LOG; fi 
if (grep "access denied" ftp_me.log); then echo "$D ERROR FTP ACCESS DENIED" >> $LOG; fi
if (grep "^Please login" ftp_me.log); then echo "$D ERROR FTP LOGIN" >> $LOG; fi

done
srcpath=/home/fcadmin/Repository\u ftp\u test/venx
CS=/FCreportsrepository/Host
SCR\u PATH=/home/fcadmin/Repository\u ftp\u test/venx
dpcpath=/fchostrjs/fcprdapp/dpcreport
日志路径=/fchostrjs/fcprdapp/dpclog
对于j in`cat venx.txt`
做
ftp-i-n>ftp_me.log;
出口
fi
EOF
exitfp=$?
如果测试$exitfp-ne 0;
然后回显“$D错误FTP”>>$LOG;
出口
fi
如果(grep“^notconnected.”ftp\u me.log);然后回显“$D错误FTP连接”>>$LOG;fi
如果(grep“无此类文件”ftp_me.log);然后回显“$D错误FTP没有这样的文件”>>$LOG;fi
if(grep“拒绝访问”ftp_me.log);然后回显“$D错误FTP访问被拒绝”>>$LOG;fi
如果(grep“^请登录”ftp_me.log);然后回显“$D错误FTP登录”>>$LOG;fi
完成