Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. file renaming

file renaming

Scheduled Pinned Locked Moved C#
comhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nnamdi Onyeyiri
    wrote on last edited by
    #1

    plz plz plz help me. someone out there must know how to rename a file. thats is the only thing standing in the way of my class. i had a look on msdn but could not find what i was looking for.


    :suss: Email: theeclypse@hotmail.com   URL: http://www.onyeyiri.co.uk
    :suss:"All programmers are playwrights and all computers are lousy actors."

    S L 2 Replies Last reply
    0
    • N Nnamdi Onyeyiri

      plz plz plz help me. someone out there must know how to rename a file. thats is the only thing standing in the way of my class. i had a look on msdn but could not find what i was looking for.


      :suss: Email: theeclypse@hotmail.com   URL: http://www.onyeyiri.co.uk
      :suss:"All programmers are playwrights and all computers are lousy actors."

      S Offline
      S Offline
      sultan_of_6string
      wrote on last edited by
      #2

      Use System.IO.File.Move(originalName, newName); After all, renaming is just moving it to the same folder with a different name.

      1 Reply Last reply
      0
      • N Nnamdi Onyeyiri

        plz plz plz help me. someone out there must know how to rename a file. thats is the only thing standing in the way of my class. i had a look on msdn but could not find what i was looking for.


        :suss: Email: theeclypse@hotmail.com   URL: http://www.onyeyiri.co.uk
        :suss:"All programmers are playwrights and all computers are lousy actors."

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        Hi Very easy indeed :) From the static methods in the File class. e.g.

        File.Move(oldfilename, newfilename);

        Moving has exactly the same effect as renaming except that you can rename to any path. But just to rename keep the paths the same. :) Now go finish that class!:-D READ MSDN

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups