gpt4 book ai didi

unix - 如何找到文件然后PSFTP到本地系统?

转载 作者:行者123 更新时间:2023-12-01 05:04:01 24 4
gpt4 key购买 nike

我正在尝试在 Unix 目录中搜索文件并使用 PSFTP 将它们复制到我的本地 Windows 机器上。

我正在运行以下命令:

sh = CreateObject("WScript.Shell")    
sh.Run "C:\PuTTY_Folder\PSFTP.EXE -b C:\PuTTY_Folder\script.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 .
它说: unknown command find.我想我可以用 mget用于复制多个文件,但不确定如何搜索和复制。

请建议。

链接到 PSFTP 文档:

http://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter6.html

最佳答案

我终于能够让这件事发挥作用。

    set sh = CreateObject("WScript.Shell")

set fileExec = sh.Exec("C:\PuTTY_Folder\PLINK.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_Folder\PSFTP.EXE -b folderPath\Script.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

关于unix - 如何找到文件然后PSFTP到本地系统?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30741617/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com