GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Commands to copy selected filenames to the clipboard


Clipboard commands in the default configuration:

Directory Opus comes pre-configured with menu items and hotkeys for copying the names and/or paths of selected items to the clipboard.

In the default Edit menu:

In the default right-click context menus:

You can move those around, modify their hotkeys, or add more commands for doing slightly different things.

Adding similar commands to right-click context menus:

If your right-click context menus are missing the default commands, or if you want to add extra commands to them, here is how. We will add the basic Copy File Names item, but you can modify things as needed.

  • In Opus, click Settings > Filetypes…
  • Double-click All Files & Folders, near the top of the list.
  • Select the Context Menu tab.
  • Click New
  • Enter the following information for the new filetype action:
    Action: Copy Names
    Type: Run an Opus function (not supported in Explorer)
    Function: Clipboard COPYNAMES
    (If you click the square next to the action’s name, you can also give it an icon if you wish.)
  • Click OK twice to save your changes, then Close to close the Filetypes editor.

If you now select and right-click some files in Opus, you’ll find the new command in the context menu.

Specifying what gets put in the clipboard:

You can add arguments to the command to change what is put in the clipboard. For example, you may only want the filenames and not the paths, or you might want UNC paths for files on mapped network drives (since other people may map them via a different drive-letter).

Below are some examples. Refer to the Clipboard command in the manual for full details.

  • Default:

  • Filename Only:

  • Short Paths:

  • URL:

  • UNC (network drives):

  • MD5 hash (1):
    Example_Filename.jpg : 1224d22982530cde353aa7f6a090ef55

  • MD5 hash (2):
    1224d22982530cde353aa7f6a090ef55 *Example_Filename.jpg

You can use single to make everything appear on a single line instead of one line per file. You can also combine things, for example:

  • Copy the short names, without paths, to a single line:
    Clipboard COPYNAMES=short,nopaths,single

Applying Regular Expressions to the paths:

You can modify what gets placed in the clipboard using regular expressions. Below are some examples. (See RegExp basics: Removing characters from start/end of names if you need help learning the basics of regular expressions.)

  • Copy UNC path with quotes around it:
    Clipboard COPYNAMES=unc REGEXP (.*) ""\1""

  • Copy file names without extensions:
    Clipboard COPYNAMES=nopaths REGEXP (.*)\.[^.]* \1

  • Copy paths escaped for C++:
    See separate example.

Putting the current folder’s path in the clipboard:

To re-create the Folder Path item in the default config, see the separate thread, Copy the current path to the clipboard.

Copy the whole folder listing to the clipboard:

To re-create the Complete Folder Listing item in the default config:

  • Complete Folder Listing:
    Print FOLDER AS=txt TO=clip FLATVIEW=no QUIET

Scripting, for more esoteric needs

For more complicated or esoteric requirements, where the built-in modes and/or regular expressions aren’t enough, you can use a script.

For example:


function OnClick(clickData)
	clickData.func.command.deselect = false;
	tab = clickData.func.sourcetab;

	if (tab.selected.count == 0)
		// Nothing selected? Do the whole folder.
		NamesToClipboard(tab.dirs, tab.files);
		// Something selected? Do just the selection.
		NamesToClipboard(tab.selected_dirs, tab.selected_files);

function NamesToClipboard(dirs, files)
	s = "";

	for (var eDirs = new Enumerator(dirs); !eDirs.atEnd(); eDirs.moveNext())
		// Directory names as-is.
		s += eDirs.item().name;
		s += "\n"; // Each name on a new line.

	for (var eFiles = new Enumerator(files); !eFiles.atEnd(); eFiles.moveNext())
		// File names excluding extensions.
		s += eFiles.item().name_stem_m;
		s += "\n"; // Each name on a new line.


How To Add 'Copy as Path' to Opus context menu?
Including filname in the path displayed
List of files and folders from FIND window sending to Clipbo
[Feature Request] Add a "Copy path to clipboard"
Button to copy directory path of a folder?
How to copy MD5 Checksum column?
Stuck...copy link location/make 4 personal views
Clipboard COPYNAMES doesn't work anymore with current folder
Copy path to clipboard, escaped for Javascript, C++
Get complete URL of a file?
Copy path and filename
Copynames right click
Copy file name as full path
Customized Print Files... button not working quite right
Right Click a file; Copy Path to Clipboard
How to invoke the Copy-> Copy Filenames menu from shortcut
Description Field
Copy path to clipboard
How to copy the lister folder name?
Selecting the extention when copying a file name
Copy part or all of a file name
Copy selected filenames to clipboard - from FTP
Copy selected filenames as URL including UNC?
MD5 in Context Menu
How to copy path to clipboard?
Copy the current path to the clipboard
Problem adding file to clipboard
How can I create a path+file name list of selected files?
How can I create a path+file name list of selected directori
How can I create a path+file name list of selected files?
MD5 Checksum calculation for only selected files?
Button to toggle and auto-size MD5 column
MD5 Checksum
MD5 or other file hash calculator
List of FAQs organised by topic
Filename to Clip
Right click COPYNAMES lost
How to copy files names without extend name?
Selecting the extention when copying a file name
Suggestion: "Copy filename" context menu command
How to install JScript describe in Copy Selected Filenames
Copy filenames separated by newlines?
Custom Context Menu commands: YOUR favorites?
Commands to copy selected filenames to the clipboard, with files & folder sizes
Copy a file's path in a library