Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > Directory Contents to .txt file?

Directory Contents to .txt file?
Thread Tools
KeyLimePi
Mac Elite
Join Date: Sep 2000
Location: Baltimore
Status: Offline
Reply With Quote
Aug 6, 2003, 12:08 PM
 
Forgive me if this is the wrong place for this, but I have a folder with more than 200 PDF files and I need a list of them by file name.

I've seen a friend working in DOS use a command that created a text file of a directory's contents. Is there a UNIX/OS X command I could use to do the same thing? Keep in mind I've pretty much never opened the Terminal, so if it's too tricky feel free to just pat me on the head and tell me to run along.
     
:XI:
Mac Elite
Join Date: Sep 2002
Status: Offline
Reply With Quote
Aug 6, 2003, 12:17 PM
 
you don't need the terminal to do this.

open the folder (in the finder)
command-a (select all)
command-c (copy)

open text edit.
command-v (paste)

instant list of files and folders in the folder.
     
KeyLimePi  (op)
Mac Elite
Join Date: Sep 2000
Location: Baltimore
Status: Offline
Reply With Quote
Aug 6, 2003, 01:52 PM
 
No way?! It's that simple? I should have tried this first.

I know that if you have the Print Center icon in your dock, you can drag a folder onto it and it will print a list of the contents.

Thanks for the info.
     
pimephalis
Dedicated MacNNer
Join Date: Nov 2002
Location: Rouge River
Status: Offline
Reply With Quote
Aug 6, 2003, 02:06 PM
 
Originally posted by KeyLimePi:
Forgive me if this is the wrong place for this, but I have a folder with more than 200 PDF files and I need a list of them by file name.

I've seen a friend working in DOS use a command that created a text file of a directory's contents. Is there a UNIX/OS X command I could use to do the same thing? Keep in mind I've pretty much never opened the Terminal, so if it's too tricky feel free to just pat me on the head and tell me to run along.
Sure.

'ls -l > filename.txt'

The '>' means dump the output of the command to the left into the entity on the right. In other words, give me the directory contents and dump them into a file I called 'filename.txt'.
Swimming upstream since 1994.
     
warpmoon
Forum Regular
Join Date: Sep 2000
Location: The dark side of the moon
Status: Offline
Reply With Quote
Aug 6, 2003, 03:45 PM
 
Or, simply do "ls > filename.txt" which will produce a list with only file names.
     
:XI:
Mac Elite
Join Date: Sep 2002
Status: Offline
Reply With Quote
Aug 6, 2003, 06:54 PM
 
Originally posted by KeyLimePi:
I know that if you have the Print Center icon in your dock, you can drag a folder onto it and it will print a list of the contents.

Thanks for the info.
heh, I didn't know that. thanks.

     
Moose
Senior User
Join Date: May 2001
Status: Offline
Reply With Quote
Aug 7, 2003, 11:51 AM
 
Originally posted by warpmoon:
Or, simply do "ls > filename.txt" which will produce a list with only file names.
ls -1 if you want just one per line.

EDIT: Although ls does this if you pipe anyway.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 02:48 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,