Re: Upload to an sftp server using vbscript





"Justin Piper" wrote:

On Mon, 07 May 2007 19:53:46 -0500, tooMuchCode
<tooMuchCode@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Currently I have a vbs file that runs a rather elaborate query against
an SQL server, the data is exported to a csv file and then emailed to
a client. This vbs file actually works really well, however the client
has requested that we start uploading it to an sftp site instead.

Instead of reinventing the wheel I assumed that I could replace a few
email lines of code with a few ftp commands. I researched the web and
found several examples utilizing ftp.exe. Through further research I
found that ftp.exe offers no support for a port higher than 21.
Therefore I assume that ftp.exe offers no support for sftp.

Can anyone offer me a solution that will allow me to upload to an sftp
server without rewriting this code in some other format!

PuTTY includes an SFTP client. The commands are largely the same as
those for ftp.exe, so you may find you can adapt one of the examples you
found to drive it instead. The program is called "psftp.exe", and can be
downloaded either by itself or as part of the full distribution from
this page:

http://www.chiark.greenend.org.uk/~sgtatham/putty/


--
Justin Piper
Bizco Technologies
http://www.bizco.com/

Thanks Justin,

I checked out Putty and actually ended up using it, but for others sack I
ended up using it a little different. I ended up using pscp. There is more
information at: http://www.tartarus.org/~simon/puttydoc/Chapter5.html.

To maybe help someone save some time I actually used the command in a bat
file like this:

C:\Temp\pscp -2 -batch -pw myPassword c:\Temp\*.txt
userName@xxxxxxxxxxxxxxxxxxx:"/path/on/server"
C:\Temp\Logs\DaltonLog%Date:~-9,1%-%Date:~-6,1%-%Date:~-4,4%.txt

C:\Temp\pscp - According to the preceding website you need to put in a path
statement but if you hardcode the path to pscp you don't need it.

-2 (forces SSH connection.)
-batch (allows me to push more than one file at a time)
-pw myPassword (obviously allows me to specify the password)
C:\Temp\*.txt (grabs all text files in that directory)
userName@xxxxxxxxxxxxxxxxxxx:"/path/on/server" (This one is pretty self
explanatory)
The part after the >> simply creates a log file in the C:\Temp\Logs
directory. It will not create the directory structure but it will create a
text file using todays date.

Thanks again Justin, you really helped me out!

Best Regards,
tooMuchCode




.



Relevant Pages

  • Re: Upload to an sftp server using vbscript
    ... an SQL server, the data is exported to a csv file and then emailed to ... This vbs file actually works really well, however the client ... Therefore I assume that ftp.exe offers no support for sftp. ...
    (microsoft.public.scripting.vbscript)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I think it will ameliorate the situation if you clean up the client as ... And to come back to my problem: I think with help of the SQL Server admins ... closed connections - but all of these errors are in the version which used ... Every new client opens again 30 connections if I open 30 tables ...
    (microsoft.public.sqlserver.connect)
  • Re: Best way to populate webpages from multiple tables
    ... tables within hash tables, custom classes etc. ... > Set a session expiring cookie at the client that stores the Customer ID. ... > send it to the client, instead store it in your session mgmt sql server - ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Best way to populate webpages from multiple tables
    ... tables within hash tables, custom classes etc. ... > Set a session expiring cookie at the client that stores the Customer ID. ... > send it to the client, instead store it in your session mgmt sql server - ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... an Access database in former times this was a lot of work which took me ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... client for programming easy, fast and good applications. ...
    (microsoft.public.sqlserver.connect)

Quantcast