Affiliate Disclosure
If you buy through our links, we may get a commission. Read our ethics policy.

How to create a list of all the files inside a macOS directory in seconds with TextEdit

Last updated

On the rare occasion a list of all of the files within a folder are required, there is a simpler way than manually typing it out or creating a collage of Finder screenshots. AppleInsider reveals how to compile the list using TextEdit.

There aren't many reasons why one would want to create a list of file names, but sometimes it can be quite a useful thing to produce. For example, a developer may want to keep a record of files and folders within a directory when they are producing an app, while those with extensive media collections could require a list based on their archives.

First, open up the folder you want to create the list from, and select all of the files and folders you want to include. Once all of the relevant files and folders are selected, copy the list by either selecting Edit then Copy Items in the menu or the Command-C keyboard shortcut.

Open up TextEdit, Apple's included text editor, and create a New Document. Once it is open, go to Format in the Menu and select Make Plain Text.

Finally, paste the files into the text document by selecting Edit then Paste, right clicking the document and selecting Paste, or by using the Command-V keyboard shortcut. This will paste the entire list of file and folder names into TextEdit.

There is also the option to create the same list that includes the folder path for each item, instead of just the file names. This can be created by dragging the selected files and folders into the TextEdit document, again set to Plain Text, instead of pasting.

If the TextEdit document is kept as Rich Text, the Mac will instead attempt to insert a copy of the documents and folder into the document. By keeping it as Plain Text, only the file and folder names will be pasted.

If you want to use this list elsewhere, be sure to select the pasted text and copy it before pasting in the app you want to use, otherwise you could end up pasting a copy of the folders and files themselves.



13 Comments

randominternetperson 8 Years · 3101 comments

Apple's implementation of the "pasteboard" as part of the original Mac OS belongs in the unsung achievements in IT hall of fame (if there were such a thing).  So brilliant and versatile.

gloubibou 16 Years · 1 comment

The same works in other places where you can copy or drag files. E.g. search results in HoudahSpot. Thus the trick is not limited to files at the top level of a folder. It can also be used to compile a list of files found all over your disk.

A really cool trick related to the above: hold the command key as you drag a folder or file to a Terminal window. This changes the shell's current directory to that folder or the folder containing the file.

Many document based applications show a proxy icon found next to the document name in the title bar.  Drag this to TextEdit (or a plain text editor like BBEdit) to get the file path. Command-drag it to Terminal to go to the document's parent folder.

philboogie 15 Years · 7669 comments

1) I cannot believe I'm seeing this article.

2) I think it's easier to simply paste by Command-Option-Shift-v instead.

klock379 7 Years · 16 comments

Why not just run "ls -R > filename.txt" in a terminal window? I don't get it... UPDATE: Upon re-reading my comment, I can see how it can be misconstrued as rude or snide, and my "geekiness" can be offensive to some. Well, sorry for that. For the record, I was genuinely confused by the approach suggested in the original post. But sure, I can see how some people may be more comfortable with TextEditor.

Mike Wuerthele 8 Years · 6906 comments

klock379 said:
Why not just run "ls -R > filename.txt" in a terminal window? I don't get it...

Because not all Mac users want to use the terminal. AppleInsider is not just for you.