Saturday, 16 September 2017

rename - Any option to change Windows XP default Copy Here naming from "Copy of {name}.{ext}" to "{name}.{ext}.copy"


Is there an option or tool that will allow me to change the default naming convention for files copied into the same directory in Windows (XP) and above.


e.g. from: Copy of {name}.{ext} to: {name}.{ext}.copy


Currently:


original_file.php
Copy of original_file.php

Desired:


original_file.php
original_file.php.copy

This would make finding/working with duplicated files much easier (they auto-sort together) and the filetype (by extension) changes thus it can't accidentally "break" something (e.g. if it were a *.java file, upon compiling I would get errors)



Answer



If I understand right, you want to create duplicates of the files in the same directory. I created a .cmd file to do this via the "Send To" menu. If a name.ext.copy file already exists, it will create:



  • name.ext.copy2

  • name.ext.copy3

  • etc...


To install



  1. Go to the Start > Run... menu and type "sendto" or "shell:sendto".

  2. In the window that pops up, create a new text file.

  3. Open the new file in Notepad.

  4. Paste in the text below.

  5. Rename the text file to "Copy of.cmd" (with the quotes).


To use



  1. Select one or a group of files.

  2. Right-click on the file(s).

  3. Select the Send To... > Copy of.cmd option.


Copy of.cmd


for %%f in (%*) do call :try_copy %%f
goto :eof

:try_copy
if not exist "%~1.copy%2" goto :copy
call :try_next %1 %2
goto :eof

:copy
copy %1 "%~1.copy%2"
goto :eof

:try_next
if "%2" == "" ( set _next=2 ) else ( set /a _next=%2 + 1 )
call :try_copy %1 %_next%
goto :eof

No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...