Copy File or Directory to Next Version & Open Utility

(Version 9)

What is It?

It is a simple program that duplicates a file or directory giving the duplicate same name except for an incremented version number. E.g.

It can be configured to automatically open newly created files in an editor appropriate to the file type (as determined by file extension).

It can also be integrated with the operating system's GUI file manager to give a simple mouse-operation way of updating the version number & leaving a back-up under the old number whilst opening a file. (There are instructions here for installing it into the Microsoft Windows Explorer GUI but it is almost certainly possible (probably easier!) to do likewise on KDE Konqueror, Gnome Nautilus, Mac OX Finder etc.).

System Requirements

A Perl interpreter.

Instructions for installing it as GUI context menu add-on are only here for Microsoft Win32 Explorer. It is almost certainly possible (and probably easier!) on Unixy operating systems but I have not yet tried it.

How to Use It

From a Command Line

Run it in the normal Perl fashion ( 'perl ' followed by the name of the program followed by parameters). It takes only one parameter, the path to the file or directory to copy.

It expects the thing to be copied to be a file with a name of the form "<anything><number>.<extension>" or directory with a name of the form "<anything><number>". The contents of the directory can have any names. It will report an error if a file/directory with the next number already exits.

From a GUI File Folder/Tree View

The following description is for the Microsoft Win32 Explorer shell but it could be done similarly in other shells on other operating systems.

Position the mouse pointer over the file/directory to duplicate and click with the secondary mouse button (which is the right-hand mouse button for a right-handed user). Choose 'Send To' then this program.

What it should do

It will duplicate the file/directory if it can. It will terminate with an error message if it cannot (for example if a file with the next version number already exists). However, GUI method described above will probably hide the error messages but it should be noticeable if no new file/directory appears in the GUI window anyway.

It will then open the new file in a editor for you if you have set one for that file type in its options.


Download (7 Kb).

How to Install

For use from a Command Line

Nothing special needs to be done to install it to run from a command line, just the normal Perl script installation stuff & configure its editor options.

For use from a GUI File Folder/Tree View

This depends on the operating system & graphical shell you use. I have only tried it myself on Microsoft Windows 2000 & NT 4. If you know what the equivalent is on a different operating system then please tell me so I can include it here. Firstly install it to run from the command line then:

For Microsoft Win 2k: Create a shortcut to this program in the 'C:\Documents and Settings\<user name>\SendTo' folder. Then edit the shortcut from being the program file path but to 'perl ' followed by that path. (The explicit 'perl' addition is needed even for Active State Perl which associates *.pl files with perl.exe in order that Windows passes the parameters correctly.) This shortcut can be set to run minimised to prevent an unnecessary console window briefly popping up and vanishing again each time the program is run.

For Microsoft Win NT4: Do the same but the folder is 'C:\<operating system folder>\profiles\<user name>\SendTo'.

To configure the Editor Options

Edit the Perl program in any plain text editor. Go to the settings section where it has a load of lines after 'my %OpenWith='. Each line is of the form ''file-extension'=>'path-to-editor-program','. Edit them to link your file types to the your editor(s) you prefer. If there are not enough lines or too many, add similar lines or delete them. If you don't want this automatic opening feature then just delete all the lines there.

Known Deficiency

It does not copy file permissions fully (it just creates directories with default '775' permissions (read, write & execute for current user & current user's group and read & execute for guests)). You might like to change this if you are on multiple-user computer.

Other Perl Scripts, Disclaimers Etc.

See my computer programs index page for more simple useful computer programs.


I am not providing any guarantee of continued support for this but if you have any suggestions for simple improvements or spot any crucial or easy to fix bugs then please tell me. In particular, if you have got it linked to the GUI of Mac OS or any Unixy OS as I have already done under Microsoft Win32, I would be interested to know the details so that I can add to the installation instructions above for others to use.