Search code examples
unixvbscriptpscp

Using pscp.exe, how can I find files and then transfer from Unix to my windows system?


I can transfer files from Unix system to my windows system using pscp.exe as below:

(I am doing this in VBScript).

Function vbsMsgBox ()
    set sh = CreateObject("WScript.Shell")
    sh.Run "C:\Users\msiddiq1\New\PSCP.EXE -pw password username@host:/b_st/batchrepo/BS31GZI C:\Users\msiddiq1\New"
End Function

But I want to transfer all the files returned from the below find command to my windows system:

find /b_st/batchrepo/BS31GZI -name "*900000007*" # It returns 6 filenames.

How can i merge this command to my above pscp command?.

I cannot create a new directory. Will i have to use a loop. Please suggest.

thanks.


Solution

  • I just figured it out.

    I tried this way:

    Function vbsMsgBox ()
        set sh = CreateObject("WScript.Shell")
        sh.Run "C:\Users\msiddiq1\New\PSCP.EXE -pw password username@host:/b_st/batchrepo/BS31GZI/*900000007* C:\Users\msiddiq1\New"
    End Function
    

    It worked just fine.

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

    thanks.