Hi,
You could use code like the following
string filename = "New York Collection Letters.pdf";
string newFilename = string.Format("{0}_{1}{2}",
Path.GetFileNameWithoutExtension(filename),
DateTime.Now.ToString("yyyyMM"),
Path.GetExtension(filename));
I used string.Format, you could also just use straight string concatenation
Hope this helps
--
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
"Rhonda Tipton" <(E-Mail Removed)> wrote in message
news:GYAZe.28018$(E-Mail Removed)...
> Hello all.
> Is there a command that can be used to change the string "New York
> Collection Letters.pdf" to "New York Collection Letters_200509.pdf"?
> (right or variation of substring)
>
> Basically what I have been tasked to do is copy a file from one place to
> another changing the name of the file at the same time which may sound
> easy, but I am very new to .net. I have figured out how to copy a file
> in C# and how to get the year and the month from the current date. I just
> can't figure out how to insert the year and month at the end of the file
> name.
>
> Any help is greatly appreciated.
>
> Rhonda
>