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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Copying files with long path names

Copying files with long path names

Scheduled Pinned Locked Moved C#
csharpquestion
5 Posts 3 Posters 2 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.
  • G Offline
    G Offline
    GazzaJ
    wrote on last edited by
    #1

    Is it possible to copy a file using .NET where the path is greater than 248 characters? If not, are there any work arounds?

    R G 2 Replies Last reply
    0
    • G GazzaJ

      Is it possible to copy a file using .NET where the path is greater than 248 characters? If not, are there any work arounds?

      R Offline
      R Offline
      RizwanSharp
      wrote on last edited by
      #2

      Before asking this question you should atleast try this I hope this will work. Use File.Copy() Method Best Regards, Rizwan

      G 1 Reply Last reply
      0
      • R RizwanSharp

        Before asking this question you should atleast try this I hope this will work. Use File.Copy() Method Best Regards, Rizwan

        G Offline
        G Offline
        GazzaJ
        wrote on last edited by
        #3

        This is what I use but my path contains more than 248 characters which throws a System.IO.PathTooLongException exception. I was wondering if there was any way around this.

        1 Reply Last reply
        0
        • G GazzaJ

          Is it possible to copy a file using .NET where the path is greater than 248 characters? If not, are there any work arounds?

          G Offline
          G Offline
          Gavin Roberts
          wrote on last edited by
          #4

          Have you tried FileInfo f = new FileInfo(LongPath); f.CopyTo(NewLocation);

          G 1 Reply Last reply
          0
          • G Gavin Roberts

            Have you tried FileInfo f = new FileInfo(LongPath); f.CopyTo(NewLocation);

            G Offline
            G Offline
            GazzaJ
            wrote on last edited by
            #5

            Yes - it throws the same exception.

            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