Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / March 2005

Tip: Looking for answers? Try searching our database.

Checking whether "SomeString" is Directory or File...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kerem G?mr?kc? - 10 Mar 2005 13:43 GMT
Hi,

how can i find out, whether a given string specifies a Path or a file...

System.IO.File.Exist(UnknownString) does not work for my
application. i exactly need to know if the strng is a path or a file...

But how the h*** can i find it out....

Thanks in advance....

Kerem G?mr?kc?
Bruno Capuano - 11 Mar 2005 22:46 GMT
Hi ...
You can try to create the specified object to do these task.
For Example :

        public bool IsFile(string Data)
        {
            bool ret = false;
            try
            {
                System.IO.FileInfo f = new System.IO.FileInfo(data);
                ret = true;
            }
            catch(Exception ex)
            {}
            return ret;
        }

        public bool IsDirectory(string Data)
        {
            bool ret = false;
            try
            {
                System.IO.DirectoryInfo f = new System.IO.DirectoryInfo(data);
                ret = true;
            }
            catch(Exception ex)
            {}
            return ret;
        }

Regards !!

Bruno Capuano

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.