Mac Monterey Help Needed

I have a Mac (Monterey) situation I could use help with.

For example, in the finder, I can highlight / copy one or more documents such as text documents.

Then I create a new Apple Mail and when I click paste into the body, it will paste in the actual documents.

Many times I totally do not want this result and what I want is to simply paste the names of these documents rather than the actual file.

So what I have to do is open text edit and paste into a plain text page - and this will print out as text - the document full titles which is what I want. Then I can copy this and paste this into the email and I will get the text list in email rather than the actual documents.

Question: is there any simpler method I can use to be able to highlight items in the finder then paste only the names as text in an email rather than the actual files?

Thanks in advance - Dave

I just tested this in Monterey and it worked as expected. I created a new mail message; highlighted and copied the name of a file on my desktop; pasted into the body of the mail message → It pasted the name of the file, not the file itself.

When you highlight the name of the file, make sure you highlight like you were going to rename the file. (ie - click on the filename [dark color highlight]; then click again [light color highlight] - this means it is in rename mode; that’s what you want to copy/paste.

1 Like

Select your set of files and then paste into a Pages document. And you will get a list. You can then copy and paste this list into any other document.

In Finder’s View menu, select Show Path Bar item. Navigate to the folder or file whose name you want and you’ll see the graphical representation of the file path at the bottom of the Finder window. Right click on the folder or filename you want and select Copy “SomeName” as Pathname.

yes this will work for 1 files at a time - but how about many files?

2 Likes

Yes this is the same as I stated using Text Edit App.

1 Like

Sorry, missed that.

20

Interesting - that did copy as text. The problem is it copied the whole path not just the file itself - any way to get just the filename?

I am looking for a simple text results like:

file1.txt
file other.txt
fileThis One also.txt

I solved this like you did — except I use Tot, the simple text/note app that sits in my menu bar. So I don’t have to open and close an app or window.

Or, if there are only a few files, I paste into the subject line of the email message, then select-All, cut, and paste the resulting text of filenames into the body of the message.

The problem with the latter is that it removes all of the line breaks. It’s very hard to read like that, so I then go in and add the breaks. It’s pretty quick to do this if you only have a few files.

If I did this regularly, I’d look for a script/Shortcut/TextExpander automation.

1 Like

You can use

Option+CMD+C to copy the files,
and Shift+Option+CMD+V to paste it.

This will also copy the whole path, but you could delete the path infront of the file name with the Search and Replace Function (CMD+F, with a checkmark at “replace”), where you insert the path of the files, and leave the “Replace”-Field just empty.

2 Likes

Take a screenshot; Open screenshot in Preview; Select desired text (from the tools menu); copy; paste into mail

2 Likes

In the terminal app, use the basename command to extract the filename from a path. Type basename followed by a space and paste in the entire pathname and hit return.

The following command returns “trail” as it is the filename at the end of the pathname “/usr/bin/trail”:

basename /usr/bin/trail

1 Like

Could you paste in multiple pathnames and do a bunch at once?

No, I don’t think the command works that way. But like all UNIX commands, basename could be used repeatedly or in a loop within a script that parses multiple inputs as you suggest.

1 Like
vi test
		#!/bin/zsh
		basename $1
		basename $2

		ESC :wq

chmod +x test

./test /usr/bin/trail ~/documents/mytextfile.txt
trail
mytextfile.txt

Here is a shortcut you could try:

It has three actions:

  • Get a list of selected files in the Finder.
  • Get the name each of the files.
  • Put the list of names on the clipboard.

Note that “Service Menu” is checked under Use as Quick Action. As you may know, this allows the Shortcut to be called from the Services sub-menu in the Finder menu.

Link: Shortcuts

Hope it works for you.

(I just noticed the comment isn’t quite right, as this does not add the list directly to a mail message.)

2 Likes

Works great.

Just wondering. I am a Shortcut novice. What is the purpose of the first step?

The “Receive any input” bit before the comment?

That gets added automatically when you check the “Services Menu” checkbox. I suppose it is what enables the Shortcut to be called from the Services menu.

Yes. I learn a lot for examples, such as yours. Thank you.

1 Like