(VBScript) Create Directory on FTP Server
VBScript example showing how to create a new directory on an FTP site.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Ftp2")
set ftp = CreateObject("Chilkat.Ftp2")
ftp.Hostname = "ftp.example.com"
ftp.Username = "login"
ftp.Password = "password"
' Connect and login to the FTP server.
success = ftp.Connect()
If (success <> 1) Then
outFile.WriteLine(ftp.LastErrorText)
WScript.Quit
End If
' Create a new directory on the FTP server:
success = ftp.CreateRemoteDir("newDirName")
If (success <> 1) Then
outFile.WriteLine(ftp.LastErrorText)
WScript.Quit
End If
success = ftp.Disconnect()
outFile.Close
|