How do I make a list of what is on my flash drive?

Over a year ago I made a list of what is on my flash drive using Word for Mac. I want to make an updated list but I can't remember how I made the original. When I look it up on the internet it says to select all and print. I thought I would be able to print a list but it started to print hundreds of photos and I had to shut down the computer to stop it. Where do I look to find out how to print a simple list of what I have on my flash drive, no pictures, just a list. Using Word for Mac.

MacBook Pro 16″, macOS 14.6

Posted on Dec 25, 2024 2:38 PM

Reply
Question marked as Top-ranking reply

Posted on Dec 25, 2024 10:34 PM

grandmaJackie3952 wrote:

Thanks, but I am not sure I understand do shell script "Is -R" & quoted form of POSIX path of Headstones (my folder on the flash drive)


The suggestion is that you use the command line. In Unix – and thus in macOS – a command line interpreter is also known as a "shell."


Steps:

  • Run the Terminal application. You will find this inside the Utilities folder in your main Applications folder.
  • The Terminal program will put up a terminal emulation window, inside which is running the shell. The window will show something like the following. (The default is to tailor the prompt using names of your account, and your machine, so I made guesses as to roughly what you would see. The actual strings may be different.)


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % 


  • Select the Terminal window.
  • Type ls -R and a space character, but do not press RETURN. Now the window will look like this.


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R


  • Drag and drop the Finder icon for the drive, or folder, whose contents you want to list into the Terminal window. This is a shortcut for typing in the POSIX path name of the drive or folder – with the quote or escape characters needed to make the shell see the path as a single command line argument. If you drag in a USB flash drive that you have named "My Flash Drive" you might see something like


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R /Volumes/My\ Flash\ Drive 


  • Press RETURN. The ls command lists the contents of a directory (ls is an abbreviation of "list"), and the -R flag tells it to list the contents recursively (down through all of the folders and subfolders).
  • If I had wanted to save the output to a text file, for use elsewhere, then after I dragged in the icon for the drive or folder, I would type another space, a ">" character, and the name of the output file. (Here I would l suggest that you just use >~/Desktop/Listing.txt, which will save the output to the Desktop file Listing.txt.)


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R /Volumes/My\ Flash\ Drive >~/Desktop/Listing.txt


  • Once you have the Listing.txt file on the Desktop, you can pull it in to any Mac application that handles text.

Similar questions

6 replies
Question marked as Top-ranking reply

Dec 25, 2024 10:34 PM in response to grandmaJackie3952

grandmaJackie3952 wrote:

Thanks, but I am not sure I understand do shell script "Is -R" & quoted form of POSIX path of Headstones (my folder on the flash drive)


The suggestion is that you use the command line. In Unix – and thus in macOS – a command line interpreter is also known as a "shell."


Steps:

  • Run the Terminal application. You will find this inside the Utilities folder in your main Applications folder.
  • The Terminal program will put up a terminal emulation window, inside which is running the shell. The window will show something like the following. (The default is to tailor the prompt using names of your account, and your machine, so I made guesses as to roughly what you would see. The actual strings may be different.)


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % 


  • Select the Terminal window.
  • Type ls -R and a space character, but do not press RETURN. Now the window will look like this.


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R


  • Drag and drop the Finder icon for the drive, or folder, whose contents you want to list into the Terminal window. This is a shortcut for typing in the POSIX path name of the drive or folder – with the quote or escape characters needed to make the shell see the path as a single command line argument. If you drag in a USB flash drive that you have named "My Flash Drive" you might see something like


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R /Volumes/My\ Flash\ Drive 


  • Press RETURN. The ls command lists the contents of a directory (ls is an abbreviation of "list"), and the -R flag tells it to list the contents recursively (down through all of the folders and subfolders).
  • If I had wanted to save the output to a text file, for use elsewhere, then after I dragged in the icon for the drive or folder, I would type another space, a ">" character, and the name of the output file. (Here I would l suggest that you just use >~/Desktop/Listing.txt, which will save the output to the Desktop file Listing.txt.)


Last login: Thu Dec 26 00:36:02 on console
grandmaJackie@GrandmaJackies-MacBook ~ % ls -R /Volumes/My\ Flash\ Drive >~/Desktop/Listing.txt


  • Once you have the Listing.txt file on the Desktop, you can pull it in to any Mac application that handles text.

Dec 26, 2024 12:14 AM in response to Servant of Cats

Servant of Cats wrote:

The suggestion is that you use the command line. In Unix – and thus in macOS – a command line interpreter is also known as a "shell."


Actually, the suggestion was that you use the Script Editor application. The Script Editor application, like the Terminal application, lives in the Utilities folder.


  • Run the Script Editor.
  • Press the New Document button at the bottom of the window that comes up.
  • Type in the following lines (but not the "-----" ones)

-----

on open (theItemsDropped)

do shell script "touch ~/Desktop/Listing.txt"

repeat with itemToList in theItemsDropped

set posixItem to quoted form of the POSIX path of itemToList

set shellCommand to "ls -R " & posixItem & " >>~/Desktop/Listing.txt"

do shell script shellCommand

end repeat

end open

-----

  • Select File > Export. Set the File Format to Application. Leave the options ("Show startup screen", "Stay open after run handler", and "Run only") unchecked. Choose a name and location for the application. E.g. you could call it "List Files" and save it on the Desktop. Press the Save button.


Now, when you drag and drop folders and files on top of your new List Files application, listings will be added to a file named Listing.txt, on the Desktop. You won't need to interact with Terminal or the command line at all – even though, underneath, that is exactly what the script will be doing.


If you need to edit the script, you can run Script Editor and open the application as if it were a document. (This is why you would want to leave the "Run only" box unchecked when you did the Export.)

Dec 26, 2024 12:28 AM in response to Servant of Cats

Looking back at Niel's post, another possibility would be to use Script Editor to create an application using this single-line script.


-----

do shell script "ls -R " & quoted form of POSIX path of (choose folder) & " >~/Desktop/Listing.txt"

-----


Instead of dragging and dropping the stuff you wanted to list onto the application icon, you'd run the application and then choose a folder from a dialog. The " >~/Desktop/Listing.txt" saves the output in a text file – much as in the other script. Here there is only one ">" (instead of a ">>" to concatenate several listings, if necessary).

Dec 27, 2024 10:46 AM in response to grandmaJackie3952

The following works for me to create a .pdf file that lists the contents of folders and drives.


• Start by opening System Settings > Printers & Scanners.

• Drag your printer icon from the Printers panel onto the Desktop and close System Settings. This creates a desktop printer, and anything you drag onto it will be printed.

• Drag the folder, the contents of which you wish to print out, onto the printer icon.

• The Print dialog box will open and you can now choose to send a PDF of the file list to your Desktop or other destination on your Mac.


• You can now open the PDF, copy and paste the contents into your Word document. You may need to massage the text around a bit, but it's all there for you to play with.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I make a list of what is on my flash drive?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.