Error with pscp on Windows: "Cannot create file"

来源:互联网 发布:飞升真元锻升级数据 编辑:程序博客网 时间:2024/06/06 00:53
 I encountered the same problem this morning.I was trying to copy the contents of a remote directory to a local directorywith pscp.exe, with all the options specified on the command line (i.e.,username, keyfile, etc). The command executed successfully if I entered itdirectly, but it would give an error when it executed as part of a script:scp: <file path>:Cannot create fileI fixed the problem by appending "." (dot) to the destination directorypath.Original command line:pscp.exe <options> "remote.server:/source/file/path/*" "c:\local\file\path\"Corrected command line:pscp.exe <options> "remote.server:/source/file/path/*""c:\local\file\path\."