Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using CopyHere to upload a folder to an FTP?

397 views
Skip to first unread message

grendi

unread,
Jan 10, 2008, 11:02:59 AM1/10/08
to
Is it possible to use CopyHere to upload to FTP?

I'm using this code:

strNewRarArchiveFolder = "c:\users"
FTPUpload(strNewRarArchiveFolder)

Sub FTPUpload(path)

FTPUser = "login"
FTPPass = "password"
FTPHost = ftp.myftp.com
FTPDir = "/mydir/mysubdir/"

strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir
Set objFTP = fso.GetFolder(strFTP)

If objFSO.FolderExists(path) Then
Set objFolder = oShell.NameSpace(path)
Wscript.Echo "Uploading folder " & path & " to " & strFTP
Set CopiedObj = objFTP.CopyHere(path)
End If

End Sub

mr_unreliable

unread,
Jan 12, 2008, 2:31:45 PM1/12/08
to
grendi wrote:
> Is it possible to use CopyHere to upload to FTP?
>

Grendi, to the best of my knowledge, the answer is _NO_.

The "CopyHere" method belongs to Shell.Application. In
other words it is part of the "shell" (desktop et al),
and implemented in shell32.dll.

There are other dll's which enable you to talk to an
FTP site, for example: wininet.dll and winsock.dll.

If you are one of those odd-balls who think it is o.k.
to call api's from script, then you could translate
microsoft's sample ftp application from vb to vbs.
Here is ms's vb code "Implementing FTP Using WinInet
API from VB", found here:

http://support.microsoft.com/kb/175179

What you get is the (vb) source code, and the compiled
"vbftpjr.exe" ftp utility, which you could use from
script, by calling it as a command line utility.

But then, vbftpjr is relatively primitive, and if you
are going to use a command line utility anyway, there
are numerous others of a more modern vintage and with
more enhanced capabilities. Filezilla is mentioned
frequently by pcMag, but there are a number of others:

http://www.thefreecountry.com/webmaster/freeftpclients.shtml

There is another approach if you are amenable to using
3re-party controls, and have a modest software budget
available. There are a number of actX controls which
will do ftp, which you can find via google. And, since
vbs has an ole interface, you can use them from script.

http://www.dart.com/ctl_ftp.aspx

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

grendi

unread,
Jan 15, 2008, 8:59:58 AM1/15/08
to
Thanks Mr
I finally used the ftp utility that one can access from the Vista command
line and it works fine.
See ya
gz

0 new messages