Copy the current path to the clipboard

The button below copies the lister's current path to the clipboard.

If you want to copy the paths of selected folders and/or filenames instead, please see here instead:

Directory Opus 10 & above:

The button is part of the default configuration, in the Edit -> Copy Other menu.

It uses the same command as mentioned for Opus 9, below, but is already there for you to use it.

Directory Opus 9:

The button uses the Clipboard SET command which was new to Opus 9. The command is:

@nofilenamequoting
Clipboard SET {sourcepath$|noterm}

Here's the full button which you can copy to the clipboard and then paste into your toolbar. (To do this, enter Customize mode, then right-click some empty space on the toolbar and select Paste.)

<?xml version="1.0"?>
<button display="both">
	<label>Copy Folder Path</label>
	<icon1>#clippasteshortcut</icon1>
	<function type="normal">
		<instruction>@nofilenamequoting</instruction>
		<instruction>Clipboard SET {sourcepath$|noterm}</instruction>
	</function>
</button>

Directory Opus 8:

Opus 8 users can do something similar by replacing both lines with this alternative command:

@runmode hide
SetClip.exe {sourcepath$|noterm}

You will need to get my SetClip utility if you don't have it already. Opus 9 users do not need SetClip.exe as a similar command is now built-in to Opus.

thanks alot for the script above. Is there a way to get this to work with Collections. ie. to copy the original file path and not the path to the collection the path is in.

regards,

If you want the parent folder of the selected file:

@nofilenamequoting Clipboard SET {filepath$|..}

Is there a way to make this work in flat mode?

I'm not sure which of the things you mean, but they should all work in Flat View mode already.

When I am doing it, it only copy the path from the location where I started the Flat View Mode. It doesn't use the actual location of the file inside the subfolders. Maybe I am doing something wrong?

Which of the different commands discussed in this thread is the one you are using?

Please allow me to step in here having a question that may be related to this subject.

Following scenario

I have a number of folders and subfolders
using a button : Set FLATVIEW=Toggle,MixedNoFolders
only files may be displayed in the right window panel

Either
a) selecting all files, then Edit->Copy Other->Complete Folder Listing
or
b) select all and Print FOLDER=selected TO=clip Quiet (in my context menu)

obviously will print the contents of 1 folder only (top one)

In this case I use Tools->Print Folder Contents - tag 'Flat View' [Mixed] - to Clipboard as a 'workaround'
(ref thread 'Clipboard' Copy filenames + modified times to clipboard)

I am not sure though if there is a : 'Print .??.=selected to clip quiet' that does the same as Tools->Print Folder.

=

I'm not sure exactly what you want (have only had time to look at this thread very quickly) but you should be able to do it using the Print command and its FLATVIEW argument, I think.

I was just going through customization of some menus and I think I deleted the "copy file path" button. I went to retrieve it from the Customize... > Commands list, but it doesn't appear under the "Edit" group, nor can I find it by searching.

Separately, I have the feeling that there were other commands that appeared in default menus / toolbars that are not available from what I thought was this master list of all available default commands.

For the time being, I'll be using the scripts suggested in this thread to recreate this button, but please let me know if there's a way I can see all the default commands available to choose from.

Not all commands in the default toolbars are in the Customize dialog's Commands tab. There's an almost infinite number of possible commands, and the button editor has menus for building more possibilities. The Commands tab is just a few basic examples.

You can reset the menus to default if needed*, although most commands are simple enough to recreate. e.g. See the manual on the Clipboard command, or the FAQ here at the forum about the same thing, for help with that.

(*If you create a copy of the default toolbars and edit that, it makes life easier as you can always refer back to the original defaults, and reset them if needed, when you need to find something you've lost or deleted and find you need later. That's what I do.)

OK understood. I've recreated it using the applicable clipboard command.

Yeah if I could go back in time I would've get the default menus rather than overwrite all the defaults...

You can always duplicate the toolbars you have (via Customize / Toolbars), then reset the old originals.

1 Like