If you need a file listing to use in a document you can get it by copying and pasting from the Finder if you know a trick. But you can also get file listings as text from the Terminal and then wrap that command into a Shortcut.
Want to know more about how to use Shortcuts on your Mac? Check out this MacMost course!
Comments: 17 Responses to “How To Get File Listings As Text”
Sheldon
9 months ago
Thanks bunches
Esther
9 months ago
Wahhhhh... where were you last week??? Do you know what I had to go thru to copy the files? I think I took a screenshot, opened it in Preview so it shows text, and copied the text. Luckily it was only ONE folder, but wow.. I didn't even know that was possible!! THANK YOU!
Lee Townsend
9 months ago
Your timing is amazing. I have been trying to do this for the past week. Ta Da and there you are. Thanks!
Gus
9 months ago
I use BBEdit and drag the folder from the Finder into the BBEdit document and it does the indenting fro subfolders etc. automatically.
Al LaPierre
9 months ago
Thanks Gary, I love it when you get us involved in using the Terminal and Shortcuts, and this was a great application. I had one problem: Using Sonoma 14.4.1 and the zsh shell: I had to put double quotes around the SED command: sed -e "s;[^/]*/;\t;g"
Single quotes would not work.
David Kennedy
9 months ago
Dear Mr. Gary;
Enough of this please try app Print Window 5.app @ App Store ; i have been using this for years and it has multiple formats for files listings on you mac.
Thank me now or later.
Note: you have been around for a number of years and appreciate your MacMost.com website
Akiva Pearlman
9 months ago
As Al LaPierre pointed out, running Sonoma 14.4.1, the single quotes do not work; but unlike him, even the double quotation marks do not work. I get the following error message:
sed: option requires an argument -- e
usage: sed script [-Ealnru] -i extension]
[file ...]
sed [-Eainu] [-i extension] [-e script] ...
[-f script_file] ... [file ...]
David: Go ahead and try that. I did and I got inconsistent results so I opted for this method.
Sue Park
9 months ago
I am wondering why Apple cannot implement this function that I have been asking for many years. For the money they charge, this and many other features and functions should be available and easy to use....
jimthing
8 months ago
Good info Gary. Here's links to Homebrew and the 'Tree' formula you can easily install via Terminal - I think they're likely pertinent, from what Gary mentioned in this video (does similar things, just showing differently - another video idea, lol!): https://brew.sh https://formulae.brew.sh/formula/tree
Nelson Silva
7 months ago
Thanks for your amazing work as always!!! You are a "life" savior!!! Help me out a lot!!! Everything im learning on MacOs its with you Gary!!!
Greg
23 hours ago
Good and useful information. I cannot seem to get the copied files as a listing in the text application. It keeps wrapping the copy. Is there a text edit setting I should have in place? I've tried a number of adjustments. Running latest version of Sequoia. All advice appreciated, thanks!
Greg: Not sure what you mean. Is it that you are not getting the file listing, or that the paths are too long for the lines so they wrap to the next line (as text would normally do)?
Greg
1 hour ago
Yes, it was the path copied version. It is more like there is no carriage return on the pasted files. I've widened the text window but it doesn't seem to help.
Thanks bunches
Wahhhhh... where were you last week??? Do you know what I had to go thru to copy the files? I think I took a screenshot, opened it in Preview so it shows text, and copied the text. Luckily it was only ONE folder, but wow.. I didn't even know that was possible!! THANK YOU!
Your timing is amazing. I have been trying to do this for the past week. Ta Da and there you are. Thanks!
I use BBEdit and drag the folder from the Finder into the BBEdit document and it does the indenting fro subfolders etc. automatically.
Thanks Gary, I love it when you get us involved in using the Terminal and Shortcuts, and this was a great application. I had one problem: Using Sonoma 14.4.1 and the zsh shell: I had to put double quotes around the SED command: sed -e "s;[^/]*/;\t;g"
Single quotes would not work.
Dear Mr. Gary;
Enough of this please try app Print Window 5.app @ App Store ; i have been using this for years and it has multiple formats for files listings on you mac.
Thank me now or later.
Note: you have been around for a number of years and appreciate your MacMost.com website
As Al LaPierre pointed out, running Sonoma 14.4.1, the single quotes do not work; but unlike him, even the double quotation marks do not work. I get the following error message:
sed: option requires an argument -- e
usage: sed script [-Ealnru] -i extension]
[file ...]
sed [-Eainu] [-i extension] [-e script] ...
[-f script_file] ... [file ...]
Akiva: Are you sure you are using zsh, not bash or something else?
Is there a reason why the input can't be right clicking a location in Finder? This seems to me to be the most logical input.
David: Go ahead and try that. I did and I got inconsistent results so I opted for this method.
I am wondering why Apple cannot implement this function that I have been asking for many years. For the money they charge, this and many other features and functions should be available and easy to use....
Good info Gary. Here's links to Homebrew and the 'Tree' formula you can easily install via Terminal - I think they're likely pertinent, from what Gary mentioned in this video (does similar things, just showing differently - another video idea, lol!):
https://brew.sh
https://formulae.brew.sh/formula/tree
Thanks for your amazing work as always!!! You are a "life" savior!!! Help me out a lot!!! Everything im learning on MacOs its with you Gary!!!
Good and useful information. I cannot seem to get the copied files as a listing in the text application. It keeps wrapping the copy. Is there a text edit setting I should have in place? I've tried a number of adjustments. Running latest version of Sequoia. All advice appreciated, thanks!
Greg: Not sure what you mean. Is it that you are not getting the file listing, or that the paths are too long for the lines so they wrap to the next line (as text would normally do)?
Yes, it was the path copied version. It is more like there is no carriage return on the pasted files. I've widened the text window but it doesn't seem to help.
Greg: Are you pasting in TextEdit? Have you tried it in plain text mode, as well as in rich text mode? How about if you paste into Pages or Notes?