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. Design and Architecture
  4. [algo] Algo for naming of duplicate/clone "objects" ?

[algo] Algo for naming of duplicate/clone "objects" ?

Scheduled Pinned Locked Moved Design and Architecture
designalgorithmsquestion
5 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.
  • M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #1

    (if you can suggest a better subjet text...) In Windows Explorer when you copy/paste a file in a folder you will have something like: test.txt test - Copy.txt test - Copy (2).txt test - Copy (3).txt ... and if you copy/paste test.txt test - Copy.txt test - Copy - Copy.txt test - Copy - Copy (2).txt Is there a known (described in the Windows UI guideline) algorithm for that? Is it simple brute force search for the "next valid" name ? Thanks. Max.

    Watched code never compiles.

    G L 2 Replies Last reply
    0
    • M Maximilien

      (if you can suggest a better subjet text...) In Windows Explorer when you copy/paste a file in a folder you will have something like: test.txt test - Copy.txt test - Copy (2).txt test - Copy (3).txt ... and if you copy/paste test.txt test - Copy.txt test - Copy - Copy.txt test - Copy - Copy (2).txt Is there a known (described in the Windows UI guideline) algorithm for that? Is it simple brute force search for the "next valid" name ? Thanks. Max.

      Watched code never compiles.

      G Offline
      G Offline
      GFRANTA
      wrote on last edited by
      #2

      Why don't you name them TWINS

      Jago

      M 1 Reply Last reply
      0
      • G GFRANTA

        Why don't you name them TWINS

        Jago

        M Offline
        M Offline
        Maximilien
        wrote on last edited by
        #3

        Huh? :confused:

        Watched code never compiles.

        1 Reply Last reply
        0
        • M Maximilien

          (if you can suggest a better subjet text...) In Windows Explorer when you copy/paste a file in a folder you will have something like: test.txt test - Copy.txt test - Copy (2).txt test - Copy (3).txt ... and if you copy/paste test.txt test - Copy.txt test - Copy - Copy.txt test - Copy - Copy (2).txt Is there a known (described in the Windows UI guideline) algorithm for that? Is it simple brute force search for the "next valid" name ? Thanks. Max.

          Watched code never compiles.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          The way that Windows names files on clash depends on your Windows version. Easiest way to duplicate this is by getting the filename, and checking if there's an entry in the same directory with that constant attached; SomeDocument.docx OtherFile.txt Dialogs.bin SomeDocument - Copy.docx Desktop.ini Iterate the files, check for the constant - and add 1 to the value if appropriate. AFAIK, there's no existing API that does this for you. If there is, I definitely like to know :)

          Bastard Programmer from Hell :suss:

          M 1 Reply Last reply
          0
          • L Lost User

            The way that Windows names files on clash depends on your Windows version. Easiest way to duplicate this is by getting the filename, and checking if there's an entry in the same directory with that constant attached; SomeDocument.docx OtherFile.txt Dialogs.bin SomeDocument - Copy.docx Desktop.ini Iterate the files, check for the constant - and add 1 to the value if appropriate. AFAIK, there's no existing API that does this for you. If there is, I definitely like to know :)

            Bastard Programmer from Hell :suss:

            M Offline
            M Offline
            Maximilien
            wrote on last edited by
            #5

            Yeah, that's what I tought. Thanks.

            Watched code never compiles.

            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