PC Review


Reply
Thread Tools Rate Thread

Determining if a file string points at a drive, a path, or a file, or an onion.

 
 
theinvisibleGhost
Guest
Posts: n/a
 
      21st Mar 2006
Subject says it all really.
I'm being passed a string, and I'm wondering if theres an easy
way to determine what exactly the string points at?
Cheers
Chris.

 
Reply With Quote
 
 
 
 
Mehdi
Guest
Posts: n/a
 
      21st Mar 2006
On 21 Mar 2006 11:09:22 -0800, theinvisibleGhost wrote:

> Subject says it all really.
> I'm being passed a string, and I'm wondering if theres an easy
> way to determine what exactly the string points at?


Depends on what you really want to do. If you want to check that your
string is the path of an existing file on your hard drive or on a network
drive, you could use File.Exist() (and handle the exceptions in case the
string is not a valid path string). For drives and directories, use
Directory.Exist(). The other methods of the Directory class will help you
to determine if your dealing with a path to a drive or to a folder. For
Url, use the Uri class and catch exceptions in case the string is not a
valid Uri.

If you just want to now wether the string is a valid path string (even if
it doesn't point to any file of folder actually existing on your hard
drive), then you could use the various methods of the Path class to do
that.

Else, you can always roll on your own regex to parse the string (actually,
there are probably many examples of regex that could do that on the web)

For onions though i'm not too sure.
 
Reply With Quote
 
theinvisibleGhost
Guest
Posts: n/a
 
      21st Mar 2006
Ok I'll try those.
Thanks
:-)

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Some links to file use drive letter, others network path, it thinksit is a different file! Finny Microsoft Excel Discussion 1 13th Apr 2009 07:11 PM
Creating Excel file that points to relative path .cub file NewUser1 Microsoft Excel Programming 0 11th Jan 2008 03:59 PM
determining directory of linked file and using path as variable in ArielZusya Microsoft Access VBA Modules 3 18th Dec 2007 05:45 PM
Determining if a path is a network path (aka mapped drive - PathIsNetworkPath) Robert Munroe Microsoft C# .NET 0 10th Dec 2003 10:35 PM
Determining if a path is a directory or a file Jeremy Chapman Microsoft Dot NET Framework 1 7th Nov 2003 01:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:54 AM.