473,396 Members | 1,923 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,396 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 3630
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
0
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,...

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.