471,357 Members | 1,122 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,357 software developers and data experts.

FTPGetFile overwrite problem

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?
Jul 21 '05 #1
3 3495
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" wrote:
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?

Jul 21 '05 #2
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 [C# MVP]" wrote:
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" wrote:
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?

Jul 21 '05 #3
ok sorry, its not working now...I'm just going to use the good ole' if file
exists then delete.

Thanks,

"Bruce Johnson [C# MVP]" wrote:
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" wrote:
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?

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Florian Preknya | last post: by
5 posts views Thread by Christine Nguyen | last post: by
5 posts views Thread by Clint Stowers | last post: by
2 posts views Thread by B-Dog | last post: by
3 posts views Thread by David Baumgarten | last post: by
4 posts views Thread by jcor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.