Copy filenames separated by newlines?

I want to copy all selected files' name, using the following command the copyed filenames seperated by space.
Clipboard SET {allfile|noext}
How could I copy filenames in seperated lines.
Clipboard SET {allfile|noext|sep=\n}, the "sep=" doesn't support "\n"

Edit > Copy Full Pathnames in the default toolbars already does this.

The command it runs is Clipboard COPYNAMES=unc (although the =unc part isn't important here).

See also: FAQ on Commands to copy selected filenames to the clipboard.

Clipboard COPYNAMES=nopaths
Use this command to copy filename include files' extentions. how to get rid of it?

That's explained in the FAQ: "Applying Regular Expressions to the paths".
Try this:

Clipboard COPYNAMES=unc,nopaths REGEXP (.*)\.[^.]* \1

[quote="kundal"]That's explained in the FAQ: "Applying Regular Expressions to the paths".
Try this:

Clipboard COPYNAMES=unc,nopaths REGEXP (.*)\.[^.]* \1

This command can't copy the fullnames of folder when there are "." exist.

Here's a script which I think does what you want:


JScript:

[code]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);
}
else
{
	// 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.
}

DOpus.SetClip(s);

}[/code]

Thank you, Leo, This script running perfect !

Yes, thanks Leo. Very useful. For my own use I have tweaked your code so that file extensions are included by default and excluded if any qualifier key is pressed.

Regards, AB

ClipNames.dcf (6.85 KB)

Leo, there's a new problem with script, it will add a blank line at the end of the filenames.

If you want the last line to not end with a return:

[code]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);
}
else
{
// 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())
{
if (s.length > 0)
s += "\n";
// Directory names as-is.
s += eDirs.item().name;
}

for (var eFiles = new Enumerator(files); !eFiles.atEnd(); eFiles.moveNext())
{
if (s.length > 0)
s += "\n";
// File names excluding extensions.
s += eFiles.item().name_stem_m;
}

DOpus.SetClip(s);
}[/code]

Thanks .