Simple Filename Save to Clipboard

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Simple Filename Save to Clipboard

Post by JohnL »

Hi, I'm new to XYplorer (and loving it; wish I'd discovered it years earlier).

I can't find a particular capability that I'm looking for. I want to create a list of filenames, plus subfolders and their files, but that's all I want, i.e.:

Folder name
Filenames
Subfolder name1
Filenames
Subfolder name2
Filenames
etc.

I've tried out the "File > To Clipboard" and "Info Panel -> Report tab" features, but they all deliver too much information, e.g. file size, date, etc. I can't figure out how to pare down to just the simple list of file names. I can always post-process the listing elsewhere, but I'm trying to avoid the extra steps. Am I missing something?

Thanks!
John

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: Simple Filename Save to Clipboard

Post by highend »

Everything without paths?

You could switch on the branch view mode, select all (ctrl+a) and then ctrl+shift+p (which is normally bound
to To Clipboard - Item Name(s))...
One of my scripts helped you out? Please donate via Paypal

JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Re: Simple Filename Save to Clipboard

Post by JohnL »

Thanks for that suggestion, highend. Your method does in fact copy simple filenames (no paths, no other attributes). However, it only copies the current folder--no subfolders.

John

bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Simple Filename Save to Clipboard

Post by bdeshi »

highend wrote: You could switch on the branch view mode,
I think you missed this step.
First enable Branch View from Menu > View > Views > Branch View. or hit ctrl+shift+b. or press the branch view button on the toolbar.
Then do ctrl+a, and ctrl+shift+p.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Re: Simple Filename Save to Clipboard

Post by JohnL »

Sammay, I actually misinterpreted that step. I clicked the checkbox: Info->Report->Current Folder->Tree structure. Doh!

But your clarification got me on the right track. The technique captures all filenames, and filenames only. It ain't pretty. That is, the folder names are listed in sequence with the filenames without being set off in any way, but I can live with that.

Thanks for the help!

John

jupe
Posts: 2788
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Simple Filename Save to Clipboard

Post by jupe »

If it is of any interest to you below is another way to do it via a script instead of the gui, doing it this way you could customize it to indent the files or add a divider to the folders etc.

If you wanted to try it just goto the root path you want the list created for, and then run it from the XY addressbar (no need to be in branch view mode)

Code: Select all

text report("{dir {Name}| {Name}}<crlf>", quicksearch(,,"|"));
to learn the possibilities of the report scripting command look it up in the help file under the Advanced Topics\Scripting Commands section.

JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Re: Simple Filename Save to Clipboard

Post by JohnL »

Very nice, jupe! Even better than the gui approach. I added it to a script item in the Catalog, with these mods:

text report("{dir ==== {Fullname} ====|{Name}}<crlf>", quicksearch(,,"|"));

This sets off the folder with the equal signs before and after a full path/name. Is there a better way of repeating the equal signs?

jupe
Posts: 2788
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Simple Filename Save to Clipboard

Post by jupe »

Regarding the equal signs, the way you have done it looks ok, but you could also post process the output to count each line to find the longest line, then add as many equal signs to each line as needed to keep each line to a certain length (justified) if that is what you were asking?, the possibilities are pretty endless with scripting, you could even generate html tables etc, all script commands are pretty extensively documented in the help file.

PS: FYI, if you want the output to go straight to clipboard without the text popup, just replace the "text" prefix with "copytext".

JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Re: Simple Filename Save to Clipboard

Post by JohnL »

Thanks for the tip on copytext.

I don't need anything as pretty as even-length lines. I think I'll work out an if-then-else that sets off folder names with, say, lines before and after, but just lists filenames in a plain list.

jupe
Posts: 2788
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Simple Filename Save to Clipboard

Post by jupe »

I wasn't sure what you were asking, so in that case then this is probably close to what you are after:

Code: Select all

$div = strrepeat("=", 60); text report("{dir $div<crlf> {Fullname} <crlf>$div|{Name}}<crlf>", "<curpath>|" . quicksearch(,,"|"));

JohnL
Posts: 6
Joined: 28 Jan 2019 18:58

Re: Simple Filename Save to Clipboard

Post by JohnL »

jupe, that's perfect! Exactly what I was looking for. Thanks very much.--John

Post Reply