Re: Upload to an sftp server using vbscript
- From: tooMuchCode <tooMuchCode@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 9 May 2007 06:54:03 -0700
"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
.
- References:
- Re: Upload to an sftp server using vbscript
- From: Justin Piper
- Re: Upload to an sftp server using vbscript
- Prev by Date: Establishing SMTP address to NT accounts
- Next by Date: Backup NT Security Log
- Previous by thread: Re: Upload to an sftp server using vbscript
- Next by thread: Re: Adding IP Ports and Printers to a Print Server
- Index(es):
Relevant Pages
|