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. C#
  4. C# 2008 dynamic path

C# 2008 dynamic path

Scheduled Pinned Locked Moved C#
csharpsalestutorialquestionworkspace
5 Posts 3 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.
  • S Offline
    S Offline
    sc steinhayse
    wrote on last edited by
    #1

    Since I am new to working with C# 2008 desktop application, I have the following questions to ask since I need place files in a directory path that looks like D://app1/test/mm-dd-yyyy/customer number/type of document being worked on: 1. How would you code the month-date-year format (mm-dd-yyyy) part of the path? 2. The path of the path that stays the same is D://app1/test/. The dynamic part of the path is mm-dd-yyyy/customer number/type of document being worked on. Thus can you tell me how to code the static part of the path and setup the dynamic part of the path so that I can place files in the dymanic part of the path? 3. Once I have the new path location, can you tell me how to place files in the new directory path location?

    P 1 Reply Last reply
    0
    • S sc steinhayse

      Since I am new to working with C# 2008 desktop application, I have the following questions to ask since I need place files in a directory path that looks like D://app1/test/mm-dd-yyyy/customer number/type of document being worked on: 1. How would you code the month-date-year format (mm-dd-yyyy) part of the path? 2. The path of the path that stays the same is D://app1/test/. The dynamic part of the path is mm-dd-yyyy/customer number/type of document being worked on. Thus can you tell me how to code the static part of the path and setup the dynamic part of the path so that I can place files in the dymanic part of the path? 3. Once I have the new path location, can you tell me how to place files in the new directory path location?

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      First off, use an ISO 8601-compliant format: System.DateTime.Now.ToString ( "yyyy-MM-dd" ) ; , you'll thank me later. Then, look at Path.Combine (String, String, String, String) [^] And explore the System.IO.Path class for any other details you need.

      S 1 Reply Last reply
      0
      • P PIEBALDconsult

        First off, use an ISO 8601-compliant format: System.DateTime.Now.ToString ( "yyyy-MM-dd" ) ; , you'll thank me later. Then, look at Path.Combine (String, String, String, String) [^] And explore the System.IO.Path class for any other details you need.

        S Offline
        S Offline
        sc steinhayse
        wrote on last edited by
        #3

        Your answer about System.DateTime.Now.ToString ( "yyyy-MM-dd" ), why would I use this format? I am required to put the dymanic file in the directory structure of mm-dd-yyyy.

        P M 2 Replies Last reply
        0
        • S sc steinhayse

          Your answer about System.DateTime.Now.ToString ( "yyyy-MM-dd" ), why would I use this format? I am required to put the dymanic file in the directory structure of mm-dd-yyyy.

          P Offline
          P Offline
          PIEBALDconsult
          wrote on last edited by
          #4

          Because yyyy-MM-dd is far superior and an international standard. If you use any other format, your files won't sort properly. The other format was likely specified by an idiot and you need to educate that idiot.

          1 Reply Last reply
          0
          • S sc steinhayse

            Your answer about System.DateTime.Now.ToString ( "yyyy-MM-dd" ), why would I use this format? I am required to put the dymanic file in the directory structure of mm-dd-yyyy.

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Listen to Piebald on this one, go educate the the idiot and use the 'yyyy-mm-dd' format. To help with this make up a list of file names using the same prefix and the 2 date formats, sort them and get the idiot to find a particular date/file Oh and the rest of his recommendation is valid as well.

            Never underestimate the power of human stupidity RAH

            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