CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2012
    Posts
    1

    execute shell script present in unix box and ftp the files to windows machine via VBA

    I need to execute my shell script present in my unix/solaris box via giving login id and password and ftp the files from unix box to my windows machine using VBA macros.

    Please share the VBA code.

    Thanks in advance.

  2. #2
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: execute shell script present in unix box and ftp the files to windows machine via

    I don't know what VBA support there is for Solaris but as far as I can tell it's doable using an ordinary shell script. See this http://www.cs.bgu.ac.il/~arik/usail/...ris/ftp.1.html
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

  3. #3
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: execute shell script present in unix box and ftp the files to windows machine via

    There is no native FTP support in VBA, but Windows has an ftp command line tool much like the Solaris one. It supports the same command line options as those described in the Solaris docs linked to by S_M_A except -t plus a few more, and the meaning of -v apparently is reversed. You should be able to run the tool using the VBA Shell function.
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  4. #4
    Join Date
    Sep 2012
    Posts
    7

    Re: execute shell script present in unix box and ftp the files to windows machine via

    Don't know anything of the unix/solaris box. If you can use win32api there's a bunch of sample code to use wininet functions like InternetConnect, InternetOpen, FtpGetFile, FtpPutFile. You can loop files on an ftp server using hFind=FtpFindFirst and hFind=InternetFindNextFile (only for one hFind at the same time). If you want to loop recursively you can first loop the ftp root, create the found directories in a local tempfolder and loop them while requesting it from the ftp sever.

    But keep in mind, wininet does not support ftps or sftp, so only ftp is possible. In my own situation I wanted a secure connection for backup files and decided to use wininet for https upload.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured