Jump to content

Recommended Posts

Posted

Hi,

I have some generic FTP scripts that have been running on my PC for years - been doing this stuff with Autoit for years so very experienced with it. Just got a new PC running under Windows 10 Enterprise same as my previous PC) and setting up all my Autoit jobs to collect files from our FTP server. I am using the exact same script as on my old PC - these scripts operate multiple times per day and basically never fail.

On my new PC when the script runs it makes a connection to the FTP server and the next item is to get a list of files in a directory on the FTP server and this is where it fails - it doesn't get a list with 

   $FileArray = _FTP_FindFileFirst($Conn,$FilesToFind,$FileHandle)

The $Conn value comes from 

$Conn = _FTP_Connect($Open, $server, $username, $pass,0)

and is valid as it makes a good connection.

The $FilesToFind is the FTP directory with a filetype added - both of these values come from an ini file which is the same on both PC's, I have put some debug lines in and this is correct - no spelling mistakes etc.

The code fails whether it is compiled and run or run within sciTe editor. It is run from the C; drive on the PC so shouldn't have any Trust issues. It fails because $FileArray remains empty.

Anybody got any ideas or had something similar happen?

George

 

Posted

I am getting no error code. When it goes to find the first file it takes quite a while, probably 10-15 seconds. On my old PC it is instantaneous to get the first file info.

The variable $FileArray should contain a array of about 10 values - it comes back empty on the new PC. If I check @error it returns -1 which is just advising that it failed.

George

Posted (edited)

Check @extended, it should return _WinAPI_GetLastError() or call _FTP_GetLastResponseInfo() after _FTP_FindFileFirst().

Edited by Andreik
Posted

OK. Put in this lines directly after the call to _FTP_FindFileFirst

    $Result=_FTP_GetLastResponseInfo($iError, $Msg)

then created message box for them both

$iError comes out a 0

$Msg has test as in image below.

Not sure what that means?

image.png

Posted

Decided to do the same on my old PC and got - I wondered if the "A" in first line was ASCII which I thought would be OK for just getting the file names and attributes.

image.png.75805592453733c3b5b3557fbf8732cf.png

Posted

OK, got this sorted. 

On my old PC I used

$Conn = _FTP_Connect($Open, $server, $username, $pass,0)

which has always worked.

Changed this on new PC to

$Conn = _FTP_Connect($Open, $server, $username, $pass,1)

which puts it into Passive mode.

Still no wiser why one works and the other doesn't.

Andreik - thanks for your suggestions, they were most helpful to get me there finally. Really appreciate that.

Posted

I just tried on Win11 and it works fine. Try to turn off windows firewall and make the test again. I suspect you might have some ports blocked by the firewall.

  • 2 weeks later...
Posted

It would have to be firewall issue on the PC as both PC's are connected to the same company network and typically we are not given access to modify the firewall - company policy.

I have it working reliably so just need to put it into the grey matter memory cells for future reference.

Thanks for all your help

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
  • Recently Browsing   0 members

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