unix – 如何查找文件然后PSFTP到本地系统?
发布时间:2020-12-16 01:58:28 所属栏目:安全 来源:网络整理
导读:我试图在Unix directrory中搜索文件,并使用PSFTP将它们复制到我的本地 Windows机器上. 我正在运行以下命令: sh = CreateObject("WScript.Shell") sh.Run "C:PuTTY_FolderPSFTP.EXE -b C:PuTTY_Folderscript.txt user@host -pw password" script.txt文件
我试图在Unix directrory中搜索文件,并使用PSFTP将它们复制到我的本地
Windows机器上.
我正在运行以下命令: sh = CreateObject("WScript.Shell") sh.Run "C:PuTTY_FolderPSFTP.EXE -b C:PuTTY_Folderscript.txt user@host -pw password" script.txt文件: lcd C:Regression cd /b2/batch/ABCD find . -mtime 1 -name "*_000000022_*" -type f # I want to find the files and copy them to my local windows machine. bye find命令无法使用PSFTP. 请建议. 链接到PSFTP文档: http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter6.html 解决方法
我终于能够把这件事搞定了.
set sh = CreateObject("WScript.Shell") set fileExec = sh.Exec("C:PuTTY_FolderPLINK.EXE -pw password username@region find /filePickLoc/dir1 -name *batchID* -mmin -10 -type f") filesStr = fileExec.StdOut.ReadAll filesStr = Left(filesStr,Len(filesStr) - 1) filesArray = Split(filesStr,vbLF) createScriptFile folderPath,arr,"filePickLoc/dir1" sh.Run "C:PuTTY_FolderPSFTP.EXE -b folderPathScript.txt username@region -pw password",7,True set fileExec = Nothing set sh = Nothing 使用createScriptFile,我在运行时创建一个.txt文件,PSFTP正在使用它来传输文件. Function createScriptFile(folderPath,files,loc) set oFSO = CreateObject("Scripting.FileSystemObject") set oFile = oFSO.CreateTextFile(folderPath & "Script.txt",true) oFile.write "lcd " & folderPath & " " & vbCrLf oFile.write "cd /" & vbCrLf For Each x In files oFile.write "get " & x & " " & vbCrLf Next oFile.write "bye" oFile.Close set oFile = Nothing set oFSO = Nothing End Function (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |