PDA

Click to See Complete Forum and Search --> : change FileName


zdavis
Nov 16th, 2007, 09:04 AM
Is there anyway to programmatically change the name of a file. I can change the extension but not the name.

thanks,

-zd

RudiVisser
Nov 16th, 2007, 09:08 AM
Yes, you use the File.Move method of System.IO.

Just like you do in linux (mv filename.ext newfilename.ext).
using System.IO;

// Namespaces etc.
File.Move("old.ext", "new.ext");

Hack
Nov 16th, 2007, 09:08 AM
From MSDN (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=894559&SiteID=1)