Results 1 to 3 of 3

Thread: change FileName

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    122

    change FileName

    Is there anyway to programmatically change the name of a file. I can change the extension but not the name.

    thanks,

    -zd

  2. #2
    Hyperactive Member
    Join Date
    Dec 2006
    Location
    Ubuntu Haters Club
    Posts
    405

    Re: change FileName

    Yes, you use the File.Move method of System.IO.

    Just like you do in linux (mv filename.ext newfilename.ext).
    C# Code:
    1. using System.IO;
    2.  
    3. // Namespaces etc.
    4. File.Move("old.ext", "new.ext");
    » Twitter: @rudi_visser : Website: www.rudiv.se «

    If Apple fixes security flaws, they are heralded as proactive. If Microsoft fixes a security flaw, they finally got around to fixing their buggy OS.

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: change FileName


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width