Jump to content

Internet Toolkit & FTP downloading woes


Recommended Posts

Hi!

I've tried to search the Google and the dark side, but I didn't find anything useful. I'm asking here first because there's usually more knowledge around.

Here's the scenario:

I'm downloading all files in a directory from a FTP server in LabVIEW 8.6.1 using the NI Internet Toolkit and the FTP VIs .

If a local file exists, I'd like it to be overwritten. I'm using 'NI_InternetTK_FTP_VIs.lvlib:FTP Retrieve Multiple.vi' to do the job. It does the job just fine if the files do not exist on the local computer. But when files exist, it returns errror code 8 with message 'EOF' for the offending files in the file error array. The LabVIEW help doesn't give any clue in the VI documentation, as usual.

Now I've pinpointed the problem in 'NI_InternetTK_Common_VIs.lvlib:TCP Read Stream.vi' and 'NI_InternetTK_Common_VIs.lvlib:OpnCrtRep File.vi': The input parameters to latter indicate an operation to create or replace a file in read-only mode. See the problem already? Inside 'OpnCrtRep File.vi' the operation parameter is happily ignored when actually trying to open the file, but read-only mode is set. Next, when creating or replacing a file, the VI attempts to set the file size to 0. Which gives the error code 8. Nice.

:throwpc:

A question: do I have to roll my own solution? To my eyes either the FTP VI is broken or then I'm just being stupid. The documentation says nothing about this and as I understand from the comments inside the code it should overwrite the file.

Anyways, time to go to the big blue room to calm down...

Cheers,

Jarimatti

Link to comment

Hi!

I've tried to search the Google and the dark side, but I didn't find anything useful. I'm asking here first because there's usually more knowledge around.

Here's the scenario:

I'm downloading all files in a directory from a FTP server in LabVIEW 8.6.1 using the NI Internet Toolkit and the FTP VIs .

If a local file exists, I'd like it to be overwritten. I'm using 'NI_InternetTK_FTP_VIs.lvlib:FTP Retrieve Multiple.vi' to do the job. It does the job just fine if the files do not exist on the local computer. But when files exist, it returns errror code 8 with message 'EOF' for the offending files in the file error array. The LabVIEW help doesn't give any clue in the VI documentation, as usual.

Now I've pinpointed the problem in 'NI_InternetTK_Common_VIs.lvlib:TCP Read Stream.vi' and 'NI_InternetTK_Common_VIs.lvlib:OpnCrtRep File.vi': The input parameters to latter indicate an operation to create or replace a file in read-only mode. See the problem already? Inside 'OpnCrtRep File.vi' the operation parameter is happily ignored when actually trying to open the file, but read-only mode is set. Next, when creating or replacing a file, the VI attempts to set the file size to 0. Which gives the error code 8. Nice.

:throwpc:

A question: do I have to roll my own solution? To my eyes either the FTP VI is broken or then I'm just being stupid. The documentation says nothing about this and as I understand from the comments inside the code it should overwrite the file.

Anyways, time to go to the big blue room to calm down...

Cheers,

Jarimatti

I would defensively code a check to see if the file exists, force its attribute to be writable and delete it before trying to save (I actually do this anyway with overwriting files and have done for years). Then phone NI to see what they say. There may be a reason for it.

  • Like 1
Link to comment

I would defensively code a check to see if the file exists, force its attribute to be writable and delete it before trying to save (I actually do this anyway with overwriting files and have done for years). Then phone NI to see what they say. There may be a reason for it.

Thanks for the help.

I'll take the same approach and write the data to files myself outside the FTP VIs. This should be easy to implement as the FTP VI in question returns the data of the files in an array of strings and I already know the local paths.

Cheers,

Jarimatti

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.