Jump to content

FTP script fails to upload


Recommended Posts

Hi All,

Ran into this difficulty since a week ago and unable to successfully resolve.

Basically, have two SSID connection:

  • Test SSID (for test purpose)
  • Normal SSID (for routine use)

The ftp script perfectly works fine when it uses Test SSID.

However, when Normal SSID is used, it logins in successfully and changes to the desired directory but do not upload the files.

Tried factory reset of Normal SSID, did not help.

Had someone encountered similar issues and able to resolve? Appreciate your support, thanks in advance.

#include <String.au3>
#include <Array.au3>
#include <File.au3>
#include <FTPEx.au3>

;Sleep(1000*60*15)

While 1
    copyWebPages()
    ftpConnect()
    ConsoleWrite('Sleeping'&@CRLF)
    Sleep(1000*60*15)
WEnd

Func ftpConnect()
Global $FTPiError,$FTPsMessage

Local $sServer = '1**.***.**.**'
Local $sUsername = '********'
Local $sPass = '********'

Local $hOpen = _FTP_Open('MyFTP Control')
ConsoleWrite('Creating FTP handle'&@CRLF)
_FTP_MSG()

Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass)
ConsoleWrite('Connecting to Collaborate'&@CRLF)
_FTP_MSG()

_FTP_DirSetCurrent (  $hConn, '/collaborate/Shared/MCT/' )
ConsoleWrite('Changing the Directory'&@CRLF)
_FTP_MSG()

;_FTP_DirPutContents($hConn,@ScriptDir,'/collaborate/Shared/MCT/',1)
;ConsoleWrite('FTPing the Directory'&@CRLF)
;_FTP_MSG()

;$FilePutTest01 = _FTP_FilePut($hConn , @ScriptDir&'\0_InventoryWebPage.html', '0_InventoryWebPage.html')
;_FTP_MSG()

;$FilePutTest01 = _FTP_FilePut($hConn , @ScriptDir&'\*.htm*', '*.htm*' )
;_FTP_MSG()


local $nbOfFiles = _FileListToArray(@ScriptDir,'*.htm*',1)

for $x = 1 To $nbOfFiles[0]
ConsoleWrite('uploading the file '&$nbOfFiles[$x]&@CRLF)
$FilePutTest01 = _FTP_FilePut($hConn , @ScriptDir&'\'&$nbOfFiles[$x], $nbOfFiles[$x] )
;ConsoleWrite('uploading the file'&'&@CRLF)
_FTP_MSG()

Next



Local $ftpClose = _FTP_Close($hConn)
_FTP_Close($hOpen)

EndFunc

Func _FTP_MSG()
    _FTP_GetLastResponseInfo($FTPiError,$FTPsMessage)
    ConsoleWrite('$iError = ' & $FTPiError& @CRLF & '$sMessage = ' & $FTPsMessage & @CRLF)
EndFunc


Func copyWebPages()
    FileCopy('C:\Users\mctmo\Desktop\VB_Workarea\scripts\0_configParser\*.html', @ScriptDir,1)
    FileCopy('C:\Users\mctmo\Desktop\VB_Workarea\scripts\0_discrepancy\*.html',@ScriptDir,1)
    FileCopy('C:\Users\mctmo\Desktop\VB_Workarea\scripts\0_touchAnalyzer\*.html',@ScriptDir,1)
    FileCopy('C:\Users\mctmo\Desktop\VB_Workarea\scripts\0_scriptStatus\*.html',@ScriptDir,1)
    FileCopy('C:\Users\mctmo\Desktop\VB_Workarea\scripts\0_logisticsConsole\*.htm*',@ScriptDir,1)
EndFunc

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...