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