473,563 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(hCon nection, "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 3651
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(hCon nection, "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(hCon nection, "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(hCon nection, "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
7479
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 I've read explains about setting the flag to bring up the overwrite prompt message box, but there's no explanation on how to read the response to it....
2
2102
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 maybe it's a trick here... More details... I use wxPython, more specifically the wxColumnSorterMixin class. I want to overwrite the __OnColClick...
5
5590
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 file. I am looking at the System.IO.BinaryWriter class. There only seems to be a way to append or completely truncate the contents of a file. Does...
5
16434
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. SetWarnings On/Off has no affect. Any suggestions appreciated.
15
3315
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: overwrite of charcter in constatnt string like char *str="Hi all"; str='A'; the result of this str points to the string "Hi All"
2
27755
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 to overwrite", "Overwrite File?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
3
801
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, 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.
1
1456
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 something on it or not. Then I realized that if i forget to look if that patient already has his files and saved, it would automatically overwrite...
4
37133
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>; chomp($titul);
0
7658
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7877
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8101
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6238
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5479
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5204
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3615
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.