473,395 Members | 2,468 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 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 3629
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Gord | last post by:
Hello, If you set the flag for an overwrite prompt using the 'Save' common dialog, how do you read the response when the user clicks the Yes or No in the 'overwrite' message box? Everything...
2
by: Florian Preknya | last post by:
Is there a posibility to overwrite a private method (one that starts with __ ) ? I read that they are just formely private, they are prefixed with the class name to have an obtured visibility, so...
5
by: Christine Nguyen | last post by:
I've written a program in VB.net. I need to open a file in binary mode and edit it. I cannot find a way to partially overwrite existing data. There are certain hex values I need to replace in the...
5
by: Clint Stowers | last post by:
Access 2k Exporting a Query to as an excel file. No problem. However, I keep getting the warning that the file already exists, Overwrite Yes/No. Yes, I want to overwrite the file. ...
15
by: Ramaraj M Bijur | last post by:
Hi All, Could anyone help me to resolve following problem in C the IDE used is Microsoft VC++, Please let me know the which option in VC++ will do the needful The problem statement:...
2
by: B-Dog | last post by:
Is there a way to make vb.net to overwrite the file when moving? Here is what I'm trying to do: If System.IO.File.Exists(dest) Then 'handle overwrite here If MessageBox.Show("Do you want...
3
by: David Baumgarten | last post by:
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,...
1
by: Aere | last post by:
Hello, I'm coding a program that saves information about my patients, so i created a rich textbox for every field. (Name, Tel, etc). The program saves a .txt for each field, no matter if there is...
4
by: jcor | last post by:
Hi, I have a script that convert a file, "$novo" in this case, to a 3gp file: this is part of the script: print "qual é o título da peça? (< 36 caracteres)\n"; my $titul=<STDIN>;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.