Solved

select the path through c#

Posted on 2007-03-29
3
220 Views
Last Modified: 2013-12-17
i need this very urgent,
i hv the problem,like i hv to update file and the file is located in c:/folder/folder/march19/filename.this march19/filename will be changing everyday like if today's date is like march30th,the filename will be like march29/filename.filename is same all the time and only the date folder will be changing everyday.
this i hv to write a batch process whenever the file comes in the day........i hv to update the file .
please help me out to write code that always looks that folder like today-1..........urgent,urgent.thanks
0
Comment
Question by:hariprasadere
  • 2
3 Comments
 
LVL 11

Expert Comment

by:Babycorn-Starfish
ID: 18820913
Hi,

try this

         String[] dateParts = DateTime.Now.ToLongDateString().Split(' ');
           
        String path = @"C:/folder/folder/" + dateParts[1] + dateParts[0]+ "/filename";
   
obviously substitute folder and filename with the real bits of your path.

hope this helps
0
 
LVL 11

Accepted Solution

by:
Babycorn-Starfish earned 500 total points
ID: 18820916
oh hang on...

let me just change that to....

 String[] dateParts = DateTime.Now.ToLongDateString().Split(' ');
           
String path = @"C:/folder/folder/" + dateParts[1].ToLower() + dateParts[0]+ "/filename";
0
 

Author Comment

by:hariprasadere
ID: 18830865
thanks man.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question