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. Web Development
  3. ASP.NET
  4. renaming a file in disk through web application

renaming a file in disk through web application

Scheduled Pinned Locked Moved ASP.NET
helpsysadmin
3 Posts 2 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.
  • S Offline
    S Offline
    Sunil Wise
    wrote on last edited by
    #1

    yesterday Mr.John sir has helped me in one issue which is related to the same task code--- else if (txtHospitalName.Text== "Medb" || txtHospitalName.Text== "Medw") { FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); } hello frns the above is the snippet of code i used in my application what i am doing is copying a file and saving it with the someother name its working fine, but the actual problem is i'll be having two types of files in my folder one is .mp3 and .wav . so in the above code i am checking only the .wav file note: i'll be entering only the name of the file without extension, there may be any one of the two filetypes. what are the modifications/additions i have to make in my code to check for two types of file extensions thanks for ur replies in advance

    M 1 Reply Last reply
    0
    • S Sunil Wise

      yesterday Mr.John sir has helped me in one issue which is related to the same task code--- else if (txtHospitalName.Text== "Medb" || txtHospitalName.Text== "Medw") { FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); } hello frns the above is the snippet of code i used in my application what i am doing is copying a file and saving it with the someother name its working fine, but the actual problem is i'll be having two types of files in my folder one is .mp3 and .wav . so in the above code i am checking only the .wav file note: i'll be entering only the name of the file without extension, there may be any one of the two filetypes. what are the modifications/additions i have to make in my code to check for two types of file extensions thanks for ur replies in advance

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      sunilwise wrote:

      FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); }

      FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (!thefile1.Exists){ thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".mp3"); } if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); }

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

      S 1 Reply Last reply
      0
      • M Michael Sync

        sunilwise wrote:

        FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); }

        FileInfo thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav"); if (!thefile1.Exists){ thefile1 = new FileInfo(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".mp3"); } if (thefile1.Exists) { File.Copy(Server.MapPath("RtfFilesPath") + "\\voice\\" + txtOriginalName.Text.Trim() + ".wav", Server.MapPath("RtfFilesPath") + "\\voice\\" + txtFilename.Text.Trim() + thefile1.Extension); GetData(); }

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

        S Offline
        S Offline
        Sunil Wise
        wrote on last edited by
        #3

        thanks for u r answers sir its working fine :):):):cool:

        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