Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic File Path 1

Status
Not open for further replies.

dandot

Programmer
Jul 19, 2005
53
CA
How would I create a string for a dynamic file path for something like this

"\\2008\2008-09\2008-09-08\DEFAULT.txt"

I planned on using DateTime.Now function to get the year and month etc but the \ are giving me headaches with the string
 
Code:
DateTime date = DateTime.Today;
string.Format(@"\\{0:YYYY}\{0:YYYY-MM}\{0:YYYY-MM-dd}\DEFAULT.txt", date);
or
Code:
DateTime date = DateTime.Today;
string.Format("\\\\{0:YYYY}\\{0:YYYY-MM}\\{0:YYYY-MM-dd}\\DEFAULT.txt", date);

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top