Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks! 12 4520
Try this:
Dim strPath As String =
Environment.GetFolderPath(Environment.SpecialFolde r.Personal).ToString
Dim strFile As String = IO.Path.Combine(strPath, "Test.txt")
MessageBox.Show(IO.File.Exists(strFile).ToString)
--
Newbie Coder
(It's just a name)
I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <ba**********@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:
I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
>
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -
On Feb 12, 4:24 pm, "snow" <barbara_d...@yahoo.comwrote:
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
Do you have quotes around the path on the command line?
On Feb 12, 1:41 pm, z...@construction-imaging.com wrote:
On Feb 12, 4:24 pm, "snow" <barbara_d...@yahoo.comwrote:
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
>news:11**********************@m58g2000cwm.googleg roups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
Do you have quotes around the path on the command line?- Hide quoted text -
- Show quoted text
Yes, I put quotes around the path, if the filePath = "C:\my_file
\test.txt", function File.exists(filePath) returns true; if I change
the filePath = "C:\my file\test.txt", and file exists,
File.Exists(filePath) returns false.
On Feb 12, 4:56 pm, "snow" <barbara_d...@yahoo.comwrote:
On Feb 12, 1:41 pm, z...@construction-imaging.com wrote:
On Feb 12, 4:24 pm, "snow" <barbara_d...@yahoo.comwrote:
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
Do you have quotes around the path on the command line?- Hide quoted text -
- Show quoted text
Yes, I put quotes around the path, if the filePath = "C:\my_file
\test.txt", function File.exists(filePath) returns true; if I change
the filePath = "C:\my file\test.txt", and file exists,
File.Exists(filePath) returns false.
As others have said here, I have never had this problem and I use
File.Exists on paths with embedded spaces all the time. There is still
something you are not telling us about your scenario.
Please make sure that you don't have the quotes in the string you are
sending. I would advise to put up a msgbox just prior to the file.exists
call. I have never seen this fail.
LS
"snow" <ba**********@yahoo.comwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:
>I have lots of directories with that case and have never seen what you describe. Ensure that the folder name is correct. What dot.net version are you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googleg roups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
>>
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -
On Feb 12, 1:57 pm, "Lloyd Sheen" <a...@b.cwrote:
Please make sure that you don't have the quotes in the string you are
sending. I would advise to put up a msgbox just prior to the file.exists
call. I have never seen this fail.
LS"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@j27g2000cwj.googlegr oups.com...
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:
I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version
are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
>news:11**********************@m58g2000cwm.googleg roups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Thanks for the advice. You are right, if I delete the quotes around
the file path on the command line, it works! but I still have the
problem in the following case. If I drag the file from the window
explorer and drop it to the program exe icon on the desktop, I still
got "File not Found", the reason is the file path was added quotes
automaticlly. How to make drag and drop the file work with white space
in the file path? I am using Microsoft.VisualBasic.Command() to
capture the file path.
Either use the short path name or surround the filename with quotes as the
previous user suggested
--
Newbie Coder
(It's just a name)
I think that all you need to do is replace all " in the command argument
with string.empty.
A quote is not a valid character for folder or file names so you can do this
and it should work correctly.
LS
"snow" <ba**********@yahoo.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
On Feb 12, 1:57 pm, "Lloyd Sheen" <a...@b.cwrote:
>Please make sure that you don't have the quotes in the string you are sending. I would advise to put up a msgbox just prior to the file.exists call. I have never seen this fail.
LS"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@j27g2000cwj.googleg roups.com...
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote: I have lots of directories with that case and have never seen what you describe. Ensure that the folder name is correct. What dot.net version are you targeting?
>LS
>"snow" <barbara_d...@yahoo.comwrote in message
>>news:11**********************@m58g2000cwm.google groups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my
document
\test.txt", the function File.Exists(filePath) always return false
in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
>- Show quoted text -- Hide quoted text -
- Show quoted text -
Thanks for the advice. You are right, if I delete the quotes around
the file path on the command line, it works! but I still have the
problem in the following case. If I drag the file from the window
explorer and drop it to the program exe icon on the desktop, I still
got "File not Found", the reason is the file path was added quotes
automaticlly. How to make drag and drop the file work with white space
in the file path? I am using Microsoft.VisualBasic.Command() to
capture the file path.
On Feb 12, 4:23 pm, "Lloyd Sheen" <a...@b.cwrote:
I think that all you need to do is replace all " in the command argument
with string.empty.
A quote is not a valid character for folder or file names so you can do this
and it should work correctly.
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@v45g2000cwv.googlegr oups.com...
On Feb 12, 1:57 pm, "Lloyd Sheen" <a...@b.cwrote:
Please make sure that you don't have the quotes in the string you are
sending. I would advise to put up a msgbox just prior to the file.exists
call. I have never seen this fail.
LS"snow" <barbara_d...@yahoo.comwrote in message
>news:11**********************@j27g2000cwj.googleg roups.com...
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:
I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net
version
are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
>news:11**********************@m58g2000cwm.googleg roups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my
document
\test.txt", the function File.Exists(filePath) always return false
in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
Thanks for the advice. You are right, if I delete the quotes around
the file path on the command line, it works! but I still have the
problem in the following case. If I drag the file from the window
explorer and drop it to the program exe icon on the desktop, I still
got "File not Found", the reason is the file path was added quotes
automaticlly. How to make drag and drop the file work with white space
in the file path? I am using Microsoft.VisualBasic.Command() to
capture the file path.- Hide quoted text -
- Show quoted text -
Thanks! it works now.
I am so sorry; call me ignorant
can you even use the 1.0 framework with VS.net 2003?
grow a clue, kid
DOTNET sucks a big fat hairy cock and MS is preparing 'yet another
visual fred'
now is the time for action, kids
LIFE IS DOTNOT PEACHY
On Feb 12, 1:24 pm, "snow" <barbara_d...@yahoo.comwrote:
On Feb 12, 1:01 pm, "Lloyd Sheen" <a...@b.cwrote:I have lots of directories with that case and have never seen what you
describe. Ensure that the folder name is correct. What dot.net version are
you targeting?
LS
"snow" <barbara_d...@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...
I am using .net frame work 1.0 with VS.net 2003. The file path is
defined by the command line. It doesn't matter it is a special folder
or not. if only the directory name contains a white space, like "C:\my
file\test.txt", "C:\test file\test.txt", the function
File.Exists(filePath) always return false, even the file exists in
that direcotry.
Hi All,
I noticed if file path has a white space, for example "C:\my document
\test.txt", the function File.Exists(filePath) always return false in
release mode. How could I make this function work for the file which
is located in a direcotry with a white space?
Thanks!- Hide quoted text -
- Show quoted text -- Hide quoted text -
- Show quoted text -
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Masiar Farahani |
last post by:
Hi,
Is there a option in PythonWin to write files in unix file mode?
Regards
Masiar
|
by: Rob Manger |
last post by:
Hi Guys,
Urgent problem. Trying to compile my solution I get the following error:
Linking...
LINK: fatal error LNK1181: cannot open input file 'Release\icmpping.abj'
Note, I havn't changed...
|
by: laurie |
last post by:
Hi.
Does anyone know of a simple asp script that can check free disk space and send an email to someone when low disk space occurs? I
am not familiar with asp. I am from a php background but our...
|
by: eva.monsen |
last post by:
I'm trying to run a .BAT file using System.Diagnostics.Process. I'm
having trouble getting Process.ExitCode to match up with what the .BAT
file returns.
Here are the contents of...
|
by: Italian Pete |
last post by:
Hi,
I have a website sitting on a server (ServerA) with images to be
displayed sitting on a separate server (ServerB) on the same network.
I am trying to test for the existance of an image...
| |
by: ganeshp |
last post by:
Below given is the code to check if a file exists.
This code works on Windows but on Linux it fails even when the file exists.
Please let me know if you have a solution or a work around for this....
|
by: Steve K. |
last post by:
I have a method that I use to get a System.Drawing.Image from a file without
keeping a handle on the file open (so I can delete the file). Here is the
code:
<code>
public static Image...
|
by: globalrev |
last post by:
print os.path.exists('C:\Users\saftarn\Desktop\NetFlixDataSet
\trainingsetunzipped\training_set\mv_0000001.txt')
d=open('C:/Python25/myPrograms/mapexperiments/maps/provinces-of-
sweden.gif')...
|
by: Samuel R. Neff |
last post by:
I have a file in a directory that is returned from
Directory.GetFiles() but subsequently fails a File.Exists() check.
Test code:
string p = @"C:\documents and settings\all users\" +...
|
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...
|
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,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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: 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...
|
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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |