我有一个Test
文件夹,其中包含具有两种文件名的多个文件,如下所示:
Cycle2605.zip
Cycle2605_P.zip
Cycle2705.zip
Cycle2705_P.zip
我要做的是,通过WinSCP SFTP将所有文件从文件夹移动到其他服务器,如下面的代码所示。
open sftp://user:password@hostname/ -hostkey="ecdsa-sha2*******"
put D:\Users\AALADELA\Desktop\Test /cygdrive/d/VB_SHARE/astroQA/AFP/in
exit
但是如何将文件名中不包含_P
的文件移到目标而不是移到所有文件?
open sftp://user:password@hostname/ -hostkey="ecdsa-sha2*******"
if <filename not contain _p> echo put D:\Users\AALADELA\Desktop\Test /cygdrive/d/VB_SHARE/astroQA/AFP/in
exit
答案 0 :(得分:2)
您可以使用matching certain pattern排除文件-filemask
switch:
shubuntu1@shubuntu1:~/99$ docker exec -it mychrome wget -q -O - http://foo.bar
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
或者,如果文件名约定允许,则只能选择所需的文件,例如:
put -filemask=|*_P.zip D:\Users\AALADELA\Desktop\Test /cygdrive/d/VB_SHARE/astroQA/AFP/in
在这种情况下,直接在source path中使用Windows通配符会更容易:
put -filemask=Cycle????.zip D:\Users\AALADELA\Desktop\Test /cygdrive/d/VB_SHARE/astroQA/AFP/in