FTPGetFile overwrite problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to download a file from a ftp server and if the file already
exists to overwrite it.

Here is my code:
FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf",
False, 1, 0, 0)

If file does not exists then this returns true and downloads file.
If file already exists then this returns false and doesnt download file.

fFailIfExists
[in] Iindicates whether the function should proceed if a local file of the
specified name already exists. If fFailIfExists is TRUE and the local file
exists, FtpGetFile fails.

I figured setting this to false would overwrite the file. Am I confused?

If its not possible to overwrite a file, anyone have other suggestions?
 
My first thought would be to change the 'False' parameter to 0. Night not
make a difference, but then again, sometimes the interworkings of COM Interop
don't completely make sense. Along the same lines, check to make sure that
the parameters in the function declaraction statement for FtpGetFile is
correct.

If that didn't work, then I'd fall back on the "if File exists then delete"
statements before using FtpGetFile. Might not be pretty, but it would work.

Bruce
 
awesome...wierd outcome tho. I set it to 0 and it worked. Then I changed it
back to false and it worked. Don't really understand why this happened but
Thanks for the help.

Bruce Johnson said:
My first thought would be to change the 'False' parameter to 0. Night not
make a difference, but then again, sometimes the interworkings of COM Interop
don't completely make sense. Along the same lines, check to make sure that
the parameters in the function declaraction statement for FtpGetFile is
correct.

If that didn't work, then I'd fall back on the "if File exists then delete"
statements before using FtpGetFile. Might not be pretty, but it would work.

Bruce

David Baumgarten said:
I am trying to download a file from a ftp server and if the file already
exists to overwrite it.

Here is my code:
FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf",
False, 1, 0, 0)

If file does not exists then this returns true and downloads file.
If file already exists then this returns false and doesnt download file.

fFailIfExists
[in] Iindicates whether the function should proceed if a local file of the
specified name already exists. If fFailIfExists is TRUE and the local file
exists, FtpGetFile fails.

I figured setting this to false would overwrite the file. Am I confused?

If its not possible to overwrite a file, anyone have other suggestions?
 
ok sorry, its not working now...I'm just going to use the good ole' if file
exists then delete.

Thanks,

Bruce Johnson said:
My first thought would be to change the 'False' parameter to 0. Night not
make a difference, but then again, sometimes the interworkings of COM Interop
don't completely make sense. Along the same lines, check to make sure that
the parameters in the function declaraction statement for FtpGetFile is
correct.

If that didn't work, then I'd fall back on the "if File exists then delete"
statements before using FtpGetFile. Might not be pretty, but it would work.

Bruce

David Baumgarten said:
I am trying to download a file from a ftp server and if the file already
exists to overwrite it.

Here is my code:
FtpGetFile(hConnection, "1.pdf", FLocation & "\Temp\" & "1.pdf",
False, 1, 0, 0)

If file does not exists then this returns true and downloads file.
If file already exists then this returns false and doesnt download file.

fFailIfExists
[in] Iindicates whether the function should proceed if a local file of the
specified name already exists. If fFailIfExists is TRUE and the local file
exists, FtpGetFile fails.

I figured setting this to false would overwrite the file. Am I confused?

If its not possible to overwrite a file, anyone have other suggestions?
 
Back
Top