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. Versioning a file.

Versioning a file.

Scheduled Pinned Locked Moved C#
csharpannouncement
4 Posts 2 Posters 1 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.
  • U Offline
    U Offline
    udaykatakam
    wrote on last edited by
    #1

    Hi, I have an application which transfers file from one location to another specified by the path given by the user.Right now it overwrites the file if the same path and file name is given. But I want it to version the file and store it instead of overwriting it to have all the versions of the file transferred. I want to know the best way to do it in C#.

    Uday

    W 1 Reply Last reply
    0
    • U udaykatakam

      Hi, I have an application which transfers file from one location to another specified by the path given by the user.Right now it overwrites the file if the same path and file name is given. But I want it to version the file and store it instead of overwriting it to have all the versions of the file transferred. I want to know the best way to do it in C#.

      Uday

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      I would believe that this is purely a naming issue. For example keep all the files but vary the name like ..ver1, ...ver2 etc or place the older files in a different directory and separate different versions in history directory with a different name. File system doesn't typically allow several files with the same name so this cannot be overridden using c# Mika

      U 1 Reply Last reply
      0
      • W Wendelius

        I would believe that this is purely a naming issue. For example keep all the files but vary the name like ..ver1, ...ver2 etc or place the older files in a different directory and separate different versions in history directory with a different name. File system doesn't typically allow several files with the same name so this cannot be overridden using c# Mika

        U Offline
        U Offline
        udaykatakam
        wrote on last edited by
        #3

        The problem is the file transfer is predefined so the naming would also be.So the application should check and add version to the file automatically.

        Uday

        W 1 Reply Last reply
        0
        • U udaykatakam

          The problem is the file transfer is predefined so the naming would also be.So the application should check and add version to the file automatically.

          Uday

          W Offline
          W Offline
          Wendelius
          wrote on last edited by
          #4

          Let's take an example. If your destination directory is named DirA and it already contains a file named AnyFile.txt. When you transfer a newer version of this file (for example by greater timestamp), what would you like the directory to contain? \DirA\AnyFile.txt (<- older version) \dirA\??? Mika

          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