I'm trying to make a script that will check files in a directory on a website.
--------------------------------
Dim MySite,filesys, demofolder, fil, filecoll, filist, WScript
'Create a connection object and assign it to the variable
Set MySite = CreateObject("CuteFTPPro.TEConnection")
' Now set each property for the site connection
' You can omit this section to use the default values, but you should at least specify the Host
'The default Protocol is FTP, however SFTP (SSH2), FTPS (SSL), HTTP, and HTTPS can also be used)
MySite.Protocol = "FTP"
MySite.Host = "FTP.HOST.com"
'following lines are optional since the default is anonymous if no login and password are defined
MySite.Login = "LOGIN"
MySite.Password = "PASSWORD"
'if necessary, use the UseProxy method and ProxyInfo or SocksInfo properties to connect through a proxy server
MySite.UseProxy = "BOTH"
'now connect to the site (also called called implicitly when most remote methods are called)
MySite.Connect
'perform some logic to verify that the connection was made successfully
If (Not Cbool(MySite.IsConnected)) Then
MsgBox "Could not connect to: " & MySite.Host & "!"
Quit(1)
End If
'The script will now check to see if the local folder c:\temp exists and will create it if necessary
If (Not (MySite.LocalExists("c:\tempshak"))) Then
MySite.CreateLocalFolder "c:\tempshak"
End If
'Change TE's local working folder to to c:\temp
MySite.LocalFolder = "c:\tempshak"
'Check for existence of remote folder "/merchant/ONEinc/Data"
b = MySite.RemoteExists("/merchant/ONEinc/Data")
If (Not CBool(b)) Then
'Verify existence of remote folder
MsgBox "Remote folder not found!. Please make sure that the Pub folder exists on the remote site"
Quit(1)
End If
'Now download the index file to the local destination folder
MySite.Download "*.order"
'Complete. Show the status of this transfer.
MsgBox "Task done, final status is '" + MySite.Status + "'"
MySite.Disconnect
MySite.Close
'End of sample script. You can save you script and then run it by either selecting it from the Tools > Run Script menu or by double clicking on the script file in Windows
--------------------------------
What I need to do is on the ftp it needs to check the file extension. IF there is a 0001.axm but NO 0001.order then I dont want to download that file. I want to rename the extension to 0001.err. Also if there is a 0001.axm and a 0001.order then rename the 0001.axm to 0001.done. Please help! I've looked on the internet for hours with no help. Thank YOU!!!
dshak
--------------------------------
Dim MySite,filesys, demofolder, fil, filecoll, filist, WScript
'Create a connection object and assign it to the variable
Set MySite = CreateObject("CuteFTPPro.TEConnection")
' Now set each property for the site connection
' You can omit this section to use the default values, but you should at least specify the Host
'The default Protocol is FTP, however SFTP (SSH2), FTPS (SSL), HTTP, and HTTPS can also be used)
MySite.Protocol = "FTP"
MySite.Host = "FTP.HOST.com"
'following lines are optional since the default is anonymous if no login and password are defined
MySite.Login = "LOGIN"
MySite.Password = "PASSWORD"
'if necessary, use the UseProxy method and ProxyInfo or SocksInfo properties to connect through a proxy server
MySite.UseProxy = "BOTH"
'now connect to the site (also called called implicitly when most remote methods are called)
MySite.Connect
'perform some logic to verify that the connection was made successfully
If (Not Cbool(MySite.IsConnected)) Then
MsgBox "Could not connect to: " & MySite.Host & "!"
Quit(1)
End If
'The script will now check to see if the local folder c:\temp exists and will create it if necessary
If (Not (MySite.LocalExists("c:\tempshak"))) Then
MySite.CreateLocalFolder "c:\tempshak"
End If
'Change TE's local working folder to to c:\temp
MySite.LocalFolder = "c:\tempshak"
'Check for existence of remote folder "/merchant/ONEinc/Data"
b = MySite.RemoteExists("/merchant/ONEinc/Data")
If (Not CBool(b)) Then
'Verify existence of remote folder
MsgBox "Remote folder not found!. Please make sure that the Pub folder exists on the remote site"
Quit(1)
End If
'Now download the index file to the local destination folder
MySite.Download "*.order"
'Complete. Show the status of this transfer.
MsgBox "Task done, final status is '" + MySite.Status + "'"
MySite.Disconnect
MySite.Close
'End of sample script. You can save you script and then run it by either selecting it from the Tools > Run Script menu or by double clicking on the script file in Windows
--------------------------------
What I need to do is on the ftp it needs to check the file extension. IF there is a 0001.axm but NO 0001.order then I dont want to download that file. I want to rename the extension to 0001.err. Also if there is a 0001.axm and a 0001.order then rename the 0001.axm to 0001.done. Please help! I've looked on the internet for hours with no help. Thank YOU!!!
dshak