Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Path class in .NET

Path class in .NET

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpcomdata-structureslounge
29 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jaiprakash M Bankolli
    wrote on last edited by
    #1

    Recently I was read an article and got to know about Path class. Many could be know it but wanted to share with other who don't know. PATH Class allows to get file path related information in string format. This is in System.IO namespace. Some of the methods in this class are as given below: * ChangeExtension: Allows you to change the file extension of a path string. * Combines: Allows you to combine two path strings into one. * GetDirectoryName: Returns the directory information included in a path string. * GetExtension: Returns the extension included in a path string. * GetFileName: Returns the file name and extension of a path string. * GetFileNameWithoutExtension: Returns the file name without the extension for a path string. * GetFullPath: Returns the absolute path for a path string. * GetInvalidFileNameChars: Returns a character array containing the characters not allowed in file names. * GetPathRoot: Returns the root directory information for a path string. * GetRandomFileName: Returns a random file or folder name. * GetTempFileName: A uniquely named, zero-byte temporary file is created with the full path returned. * GetTempPath: The path to the system's temporary directory is returned. * HasExtension: Determines if a path string contains an extension (true) or not (false). * IsPathRooted: Gets a value indicating whether the specified path string contains absolute or relative path information. Hope you find it useful

    Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

    D 1 Reply Last reply
    0
    • J Jaiprakash M Bankolli

      Recently I was read an article and got to know about Path class. Many could be know it but wanted to share with other who don't know. PATH Class allows to get file path related information in string format. This is in System.IO namespace. Some of the methods in this class are as given below: * ChangeExtension: Allows you to change the file extension of a path string. * Combines: Allows you to combine two path strings into one. * GetDirectoryName: Returns the directory information included in a path string. * GetExtension: Returns the extension included in a path string. * GetFileName: Returns the file name and extension of a path string. * GetFileNameWithoutExtension: Returns the file name without the extension for a path string. * GetFullPath: Returns the absolute path for a path string. * GetInvalidFileNameChars: Returns a character array containing the characters not allowed in file names. * GetPathRoot: Returns the root directory information for a path string. * GetRandomFileName: Returns a random file or folder name. * GetTempFileName: A uniquely named, zero-byte temporary file is created with the full path returned. * GetTempPath: The path to the system's temporary directory is returned. * HasExtension: Determines if a path string contains an extension (true) or not (false). * IsPathRooted: Gets a value indicating whether the specified path string contains absolute or relative path information. Hope you find it useful

      Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      So what about this post is better than finding the very same information in the documentation on the Path class[^] in MSDN?

      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        So what about this post is better than finding the very same information in the documentation on the Path class[^] in MSDN?

        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        J Offline
        J Offline
        Jaiprakash M Bankolli
        wrote on last edited by
        #3

        MSDN is always good to refer to at the end, My post was to bring Path class to the notice of those who didn't knew OK.

        Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

        C 1 Reply Last reply
        0
        • J Jaiprakash M Bankolli

          MSDN is always good to refer to at the end, My post was to bring Path class to the notice of those who didn't knew OK.

          Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Jaiprakash M Bankolli wrote:

          MSDN is always good to refer to at the end

          At the end?! It is usually the first place I check.

          Jaiprakash M Bankolli wrote:

          My post was to bring Path class to the notice of those who didn't knew

          Well, in a short time this post will fall off the first page of this forum. Also, people will be unlikely to be looking for it if they didn't know about it.


          Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

          J 1 Reply Last reply
          0
          • C Colin Angus Mackay

            Jaiprakash M Bankolli wrote:

            MSDN is always good to refer to at the end

            At the end?! It is usually the first place I check.

            Jaiprakash M Bankolli wrote:

            My post was to bring Path class to the notice of those who didn't knew

            Well, in a short time this post will fall off the first page of this forum. Also, people will be unlikely to be looking for it if they didn't know about it.


            Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

            J Offline
            J Offline
            Jaiprakash M Bankolli
            wrote on last edited by
            #5

            "Well, in a short time this post will fall off the first page of this forum. Also, people will be unlikely to be looking for it if they didn't know about it. " I know it will fall off but those who read it I felt it is better to post it, You certainly can't talk about how people will behave ... You talk about yourself not for others !!

            Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

            P P 2 Replies Last reply
            0
            • J Jaiprakash M Bankolli

              "Well, in a short time this post will fall off the first page of this forum. Also, people will be unlikely to be looking for it if they didn't know about it. " I know it will fall off but those who read it I felt it is better to post it, You certainly can't talk about how people will behave ... You talk about yourself not for others !!

              Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              Jaiprakash M Bankolli wrote:

              I know it will fall off but those who read it I felt it is better to post it, You certainly can't talk about how people will behave ... You talk about yourself not for others !!

              If you feel this, then write an article on it. Make it informative and interesting, and show some examples of it in action. As Colin pointed out, the message will move down the forum and in a couple of months you won't be able to find it.

              Deja View - the feeling that you've seen this post before.

              J 1 Reply Last reply
              0
              • P Pete OHanlon

                Jaiprakash M Bankolli wrote:

                I know it will fall off but those who read it I felt it is better to post it, You certainly can't talk about how people will behave ... You talk about yourself not for others !!

                If you feel this, then write an article on it. Make it informative and interesting, and show some examples of it in action. As Colin pointed out, the message will move down the forum and in a couple of months you won't be able to find it.

                Deja View - the feeling that you've seen this post before.

                J Offline
                J Offline
                Jaiprakash M Bankolli
                wrote on last edited by
                #7

                Well that is a good suggestion, let me think about it. The only reason why i had refrained writting an article is because it is only one class .. just like this there are many many classes which should be put as awareness through a post .... but still let me think about it

                Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                P 1 Reply Last reply
                0
                • J Jaiprakash M Bankolli

                  "Well, in a short time this post will fall off the first page of this forum. Also, people will be unlikely to be looking for it if they didn't know about it. " I know it will fall off but those who read it I felt it is better to post it, You certainly can't talk about how people will behave ... You talk about yourself not for others !!

                  Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com http://jaiprakash.blog.com/

                  P Offline
                  P Offline
                  PlayByTheRules
                  wrote on last edited by
                  #8

                  Jaiprakash M Bankolli wrote:

                  You certainly can't talk about how people will behave ... You talk about yourself not for others !!

                  What put you in such a foul mood?

                  J 1 Reply Last reply
                  0
                  • J Jaiprakash M Bankolli

                    Well that is a good suggestion, let me think about it. The only reason why i had refrained writting an article is because it is only one class .. just like this there are many many classes which should be put as awareness through a post .... but still let me think about it

                    Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                    P Offline
                    P Offline
                    Pete OHanlon
                    wrote on last edited by
                    #9

                    If you're worried about it only being one class, why not work it into an article with the Directory and File classes. Aim for it being the definitive source on how to use these classes - I guarantee that you will learn a lot about them in the process of writing a good article on them.

                    Deja View - the feeling that you've seen this post before.

                    J 1 Reply Last reply
                    0
                    • P PlayByTheRules

                      Jaiprakash M Bankolli wrote:

                      You certainly can't talk about how people will behave ... You talk about yourself not for others !!

                      What put you in such a foul mood?

                      J Offline
                      J Offline
                      Jaiprakash M Bankolli
                      wrote on last edited by
                      #10

                      "What put you in such a foul mood?" I never felt it is foul mood !! Strange :-)

                      Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                      A 1 Reply Last reply
                      0
                      • P Pete OHanlon

                        If you're worried about it only being one class, why not work it into an article with the Directory and File classes. Aim for it being the definitive source on how to use these classes - I guarantee that you will learn a lot about them in the process of writing a good article on them.

                        Deja View - the feeling that you've seen this post before.

                        J Offline
                        J Offline
                        Jaiprakash M Bankolli
                        wrote on last edited by
                        #11

                        Suggestion well accepted !!! Don't worry about it

                        Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                        P 1 Reply Last reply
                        0
                        • J Jaiprakash M Bankolli

                          Suggestion well accepted !!! Don't worry about it

                          Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #12

                          To quote our Australian posters, no worries. Seriously though, I'm always looking for new and interesting articles being posted. It could be that you present a wrinkle or angle that I never thought of, and *BANG* a problem that I wrote a nasty hack to solve is cleared in 2 lines of code. Only the arrogant or truly ignorant think they know it all.

                          Deja View - the feeling that you've seen this post before.

                          J 1 Reply Last reply
                          0
                          • J Jaiprakash M Bankolli

                            "What put you in such a foul mood?" I never felt it is foul mood !! Strange :-)

                            Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                            A Offline
                            A Offline
                            Andy M
                            wrote on last edited by
                            #13

                            Some of your posts show that you are in a "foul mood". It also looks like you have been voting down anyone who disagrees with you. That is very childish.

                            J 1 Reply Last reply
                            0
                            • A Andy M

                              Some of your posts show that you are in a "foul mood". It also looks like you have been voting down anyone who disagrees with you. That is very childish.

                              J Offline
                              J Offline
                              Jaiprakash M Bankolli
                              wrote on last edited by
                              #14

                              Nope I don't feel what you are saying is correct. I felt using "foul mood" statement itself was childish :-).

                              Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                              A 1 Reply Last reply
                              0
                              • P Pete OHanlon

                                To quote our Australian posters, no worries. Seriously though, I'm always looking for new and interesting articles being posted. It could be that you present a wrinkle or angle that I never thought of, and *BANG* a problem that I wrote a nasty hack to solve is cleared in 2 lines of code. Only the arrogant or truly ignorant think they know it all.

                                Deja View - the feeling that you've seen this post before.

                                J Offline
                                J Offline
                                Jaiprakash M Bankolli
                                wrote on last edited by
                                #15

                                "Only the arrogant or truly ignorant think they know it all." This is very true statement, so only I had posted this message here so that in case someone had faced some problem in the past related to path/ directory etc could post his/her views here

                                Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                D 1 Reply Last reply
                                0
                                • J Jaiprakash M Bankolli

                                  Nope I don't feel what you are saying is correct. I felt using "foul mood" statement itself was childish :-).

                                  Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                  A Offline
                                  A Offline
                                  Andy M
                                  wrote on last edited by
                                  #16

                                  Jaiprakash M Bankolli wrote:

                                  Nope I don't feel what you are saying is correct. I felt using "foul mood" statement itself was childish

                                  Your overuse of exclamation marks does suggest that you are in some way angry or upset by the comments. Interesting that you don't deny voting people down.

                                  J 1 Reply Last reply
                                  0
                                  • A Andy M

                                    Jaiprakash M Bankolli wrote:

                                    Nope I don't feel what you are saying is correct. I felt using "foul mood" statement itself was childish

                                    Your overuse of exclamation marks does suggest that you are in some way angry or upset by the comments. Interesting that you don't deny voting people down.

                                    J Offline
                                    J Offline
                                    Jaiprakash M Bankolli
                                    wrote on last edited by
                                    #17

                                    "Your overuse of exclamation marks does suggest that you are in some way angry or upset by the comments" overuse of exclamation : Let me tell you something that is my style of writting, so that doesn't mean that am angry in any sense "Interesting that you don't deny voting people down." That is because I want people to vote irrespective of whether I get good votes or poor votes

                                    Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                    A 1 Reply Last reply
                                    0
                                    • J Jaiprakash M Bankolli

                                      "Your overuse of exclamation marks does suggest that you are in some way angry or upset by the comments" overuse of exclamation : Let me tell you something that is my style of writting, so that doesn't mean that am angry in any sense "Interesting that you don't deny voting people down." That is because I want people to vote irrespective of whether I get good votes or poor votes

                                      Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                      A Offline
                                      A Offline
                                      Andy M
                                      wrote on last edited by
                                      #18

                                      Jaiprakash M Bankolli wrote:

                                      veruse of exclamation : Let me tell you something that is my style of writting, so that doesn't mean that am angry in any sense

                                      If people don't know the style of your writing, how are they meant to tell? I certainly interpreted what you were saying as being in an angry tone. Perhaps you need to alter the style of your writing so that you don't use exclamation marks when you are in a debate or discussion with someone.

                                      J 1 Reply Last reply
                                      0
                                      • A Andy M

                                        Jaiprakash M Bankolli wrote:

                                        veruse of exclamation : Let me tell you something that is my style of writting, so that doesn't mean that am angry in any sense

                                        If people don't know the style of your writing, how are they meant to tell? I certainly interpreted what you were saying as being in an angry tone. Perhaps you need to alter the style of your writing so that you don't use exclamation marks when you are in a debate or discussion with someone.

                                        J Offline
                                        J Offline
                                        Jaiprakash M Bankolli
                                        wrote on last edited by
                                        #19

                                        You can't comment on the style in which people write, you should try to take the message from the post. This site is being visited by users groups situated in various countries so if you feel or interpret message in your way and have some thoughts, then I would suggest you should get it clarified rather then trying to improve others style of writting

                                        Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                        A 1 Reply Last reply
                                        0
                                        • J Jaiprakash M Bankolli

                                          You can't comment on the style in which people write, you should try to take the message from the post. This site is being visited by users groups situated in various countries so if you feel or interpret message in your way and have some thoughts, then I would suggest you should get it clarified rather then trying to improve others style of writting

                                          Regards, Jaiprakash M Bankolli jaiprakash.bankolli@gmail.com Blog: http://jaiprakash.blog.com/ Suggestions: http://jaitoimprove.blog.com/

                                          A Offline
                                          A Offline
                                          Andy M
                                          wrote on last edited by
                                          #20

                                          Jaiprakash M Bankolli wrote:

                                          You can't comment

                                          Oh, we're back to that old chestnut. I can comment. I can comment on anything I like. You don't have to agree. But as I'm the one that is interpreting your words I am uniquely placed to comment on them. I am the only person on this earth that can tell you how I interpret your words. I can extrapolate and suggest that others are likely to interpret them in the same way.

                                          Jaiprakash M Bankolli wrote:

                                          I would suggest you should get it clarified rather then trying to improve others style of writting

                                          If I spent all my time clarifing other people's words nothing would ever get done. If you write effectively then I won't have to clarify anything.

                                          Jaiprakash M Bankolli wrote:

                                          This site is being visited by users groups situated in various countries

                                          Absolutely, so it the writer would stick to generally held standards and conventions then we would all get along much better. Any I notice that you appear to be voting people down again... :sigh:

                                          J 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups