Note:
-
The default toolbars now include commands which are the same or very similar to the ones in this thread, for Directory Opus 11 and above.
You can find them in the menus attached to the Rename and New Folder buttons:
Summary: The rename and create-folder functions in Directory Opus are able to include the current date and time in the names they create.
If you've got a file, say one with a generic filename or one that's a backup you just made of a directory, then you might want to rename it to something unique which also captures the current date and/or time. You may also want to make a quick temporary directory using the current date without having to think of a unique name. You can make toolbar buttons (or hotkeys) in Opus which do these things in a single click.
This examples below show how to make buttons which do particular rename operations in a single click. You could also do the same operations via the Rename dialog. It is also possible to make buttons which invoke saved Rename presets in a single-click. In the example below, though, the patterns are defined directly in the buttons and no rename presets are used. Doing it this way means that you don't have to have unwanted extra entries in your Rename presets list.
With Opus in Customize mode, if you copy the button definitions below (separately) to the clipboard and then right-click an empty area of one of your toolbars then you should get a Paste option which will add the button from the clipboard to your toolbar.
This first button creates a new directory which is named after the current date and time:
<?xml version="1.0"?>
<button display="both" effect="gray">
<guid>{F1010BB0-D34D-40F6-A89D-3DFDB5F8B015}</guid>
<label>Create Dated Folder</label>
<icon1>61</icon1>
<function type="normal">
<instruction>CreateFolder NAME="{date|yyyy-MM-dd} {time|HH-mm-ss}"</instruction>
</function>
</button>
This second button will rename all of the selected files and directories by adding the date and time after their filenames. Its function body is two lines long because the first line handles the directories while the second line handles the files (making sure to add the date before the file's extension):
<?xml version="1.0"?>
<button display="both" effect="gray">
<guid>{F620C576-7C0F-40A8-84DD-DC56C8671A0D}</guid>
<label>Date-Suffix Selected Names</label>
<icon1>49</icon1>
<function type="normal">
<instruction>Rename PATTERN="*" TO="* - {date|yyyy-MM-dd} {time|HH-mm-ss}" AUTORENAME TYPE=dirs</instruction>
<instruction>Rename PATTERN="*.*" TO="* - {date|yyyy-MM-dd} {time|HH-mm-ss}.*" AUTORENAME TYPE=files</instruction>
</function>
</button>
In both cases you can edit the {date|...} and {time|...} parts of the button to alter the format of the date and time and, of course, you can remove either of them completely if you want.
Opus 12 and above: The second button could be done better, using a single line which handles both files and folders, using the new Ignore Extension rename feature. In fact, this improved version is provided for you within the default configuration, as mentioned at the top of the post.