Hello All -
Is there a way to check if a file path string is valid? I.e. is there
a function that takes some string, say 'c:\somedir\subdir' and returns
TRUE if it is valid or FALSE if no such path exists?
Thanks!
Brian 6 28761
On 2003-11-21, dave <th*****@mailcity.com> wrote: Hello All -
Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
Thanks! Brian
Imports System.IO
....
If Directory.Exists("c:\my directory") Then
...
End If
If File.Exists("C:\my directory\myfile.txt") Then
....
End If
--
Tom Shelton
[MVP - Visual Basic]
* th*****@mailcity.com (dave) scripsit: Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
'System.IO.Directory.Exists'.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
On 21 Nov 2003 10:53:51 -0800, dave <th*****@mailcity.com> wrote: Hello All -
Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
Thanks! Brian
This used to work in VB6, I havn't tried it in .NET yet.....
if dir$("C:\Myfile.xxx")="" then 'the file does not exist
if it does exist, it returns the filename back to you.
Scott
On 21 Nov 2003 10:53:51 -0800, dave <th*****@mailcity.com> wrote: Hello All -
Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
Thanks! Brian
This used to work in VB6, I havn't tried it in .NET yet.....
if dir$("C:\Myfile.xxx")="" then 'the file does not exist
if it does exist, it returns the filename back to you.
Scott
* Scott Hather <x@y.com> scripsit: Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
This used to work in VB6, I havn't tried it in .NET yet.....
if dir$("C:\Myfile.xxx")="" then 'the file does not exist
if it does exist, it returns the filename back to you.
This code has some disadvantages in VB6, it should not be used to check
if a file exists.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
* Scott Hather <x@y.com> scripsit: Is there a way to check if a file path string is valid? I.e. is there a function that takes some string, say 'c:\somedir\subdir' and returns TRUE if it is valid or FALSE if no such path exists?
This used to work in VB6, I havn't tried it in .NET yet.....
if dir$("C:\Myfile.xxx")="" then 'the file does not exist
if it does exist, it returns the filename back to you.
This code has some disadvantages in VB6, it should not be used to check
if a file exists.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mrbog |
last post by:
Tell me if my assertion is wrong here:
The only way to prevent session hijacking is to NEVER store
authentication information (such as name/password) in the session.
Well, to never authenticate...
|
by: Maciej Sobczak |
last post by:
Hi,
I have a string.
This string is to be used as a path for a new file.
I would like to check if this string *could be* a valid file name,
*before* I try to create the file itself.
In other...
|
by: David Fickbohm |
last post by:
People,
I am trying to determine the creation date of files in a folder.
I am using the following code to find the folder and confirm that files
exist in the folder. If someone could give me an...
|
by: Henry Jia |
last post by:
Hi,
Does there has any easy way to check if a specified url is a valid one (both the format should be valid but also the specified path / file is available)?
Thanks in advance!
Henry
|
by: MikeY |
last post by:
Hi all,
I am coding window forms in C#.
My problem is this: I have created a "Check ListView" or a 'ListView' with
checkbox's. I have populated the it with my files from my folders, mps, txt,...
|
by: Noozer |
last post by:
I need to keep my application settings in a file that users can
copy/backup/etc.
Before I start using the old INI file standard, is there any easy way to use
XML files to hold application...
|
by: dancer |
last post by:
Using ASP.net 1.1 and Microsoft Access.
I received the following error message. Why? I have closed the Access
file. I have another very small access file that opens with no trouble with
the...
|
by: Academia |
last post by:
I'd like to check a string to see that it is a valid file name.
Is there a Like pattern or RegEx that can do that.
1) Just the file name with maybe an extension
2)A full path
An help...
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 but can upgrade if necessary. Given a path to a
file on my server, is there a way I can check if that file is of a PDF
format? I'm guessing the answer to this may...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |