Link to home
Start Free TrialLog in
Avatar of ttanyag
ttanyag

asked on

How do you implement a "copy algorithm" (like the one in Windows Explorer)?

How do you implement a "copy algorithm" (like the one in Windows Explorer)?

ex.

  given= File1 is the original filename

  1. copy File1
     result:
       - File1
       - 'Copy of '+File1
  2. copy 'Copy of '+File1
     result:
       - File1
       - 'Copy of '+File1
       - 'Copy of '+Copy of File1
  3. copy File1
     result:
       - File1
       - 'Copy of '+File1
       - 'Copy of '+Copy of File1
       - 'Copy (2) of '+File1
  4. copy File1
     result:
       - File1
       - 'Copy of '+File1
       - 'Copy of '+Copy of File1
       - 'Copy (2) of '+File1
       - 'Copy (3) of '+File1
  5. copy 'Copy (2) of '+File1
     result:
       - File1
       - 'Copy of '+File1
       - 'Copy of '+Copy of File1
       - 'Copy (2) of '+File1
       - 'Copy (3) of '+File1
       - 'Copy (4) of '+File1

  I just need a function that will give me the appropriate new filename of the copied file.

  Thanks :)
       
ASKER CERTIFIED SOLUTION
Avatar of rondi
rondi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ttanyag
ttanyag

ASKER

thank you very much!