Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

theLemur

macrumors regular
Original poster
Jan 6, 2008
192
12
I have a massive self-developement audio library. I would like to take that folder (which is divided into categories, then by authors, then by programs) and get a list of all recursive subdirectories and files in a text file that I can send to a friend to share my library.

Any suggestions?
 
Open a terminal window
navigate to the top directory (folder) you want to list

For non UNIX users use the command 'cd name' to change directory where 'name' is the name of the directory, type 'pwd' to find out where you are.

Type 'ls -R' to do a recursive list and check that that is what you want.

Type 'ls -R > filelist'

this will create a file in your current directory called filelist, use a different name if you want to.

Check it by typing 'cat filelist'

You should be able to attach the file to an EMail message.
 
Open a terminal window
navigate to the top directory (folder) you want to list

For non UNIX users use the command 'cd name' to change directory where 'name' is the name of the directory, type 'pwd' to find out where you are.

Type 'ls -R' to do a recursive list and check that that is what you want.

Type 'ls -R > filelist'

this will create a file in your current directory called filelist, use a different name if you want to.

Check it by typing 'cat filelist'

You should be able to attach the file to an EMail message.

Problem is that I have a lot of subdirectories, and it would take hours and hours to do that for each one. I think there used to be a DOS command that would list EVERYTHING under a directory, I can't remember the command line, but I need something like that.
 
PhilRodford said the listing is "recursive". Which means it will list the contents of every subdirectory. And the contents of every subdirectory of every subdirectory. And so on. Until everything has been listed. If you think you have to manually go into every subdirectory, then you don't understand what "recursive" means.

PhilRodford also gave you specific commands to try. He also said "check that that is what you want".

Did you try what he gave you? If so, did it produce what you want?

If you didn't try it, then you should do so, so you can see what it does. If you try it and it doesn't do what you want, then by all means, post again with a specific description of why it's not what you want. But if you haven't tried it, and you don't know what "recursive" means, then complaining is premature.
 
PhilRodford said the listing is "recursive". Which means it will list the contents of every subdirectory. And the contents of every subdirectory of every subdirectory. And so on. Until everything has been listed. If you think you have to manually go into every subdirectory, then you don't understand what "recursive" means.

PhilRodford also gave you specific commands to try. He also said "check that that is what you want".

Did you try what he gave you? If so, did it produce what you want?

If you didn't try it, then you should do so, so you can see what it does. If you try it and it doesn't do what you want, then by all means, post again with a specific description of why it's not what you want. But if you haven't tried it, and you don't know what "recursive" means, then complaining is premature.

It was late when I read it, so I missed that part and thought it was just a directory listing. Thank you for spending your time correcting me.
 
Windows version of subdirectory listing...

The command for this in Dos are "dir/s" if you should refer to it again.
 
Problem is that I have a lot of subdirectories, and it would take hours and hours to do that for each one. I think there used to be a DOS command that would list EVERYTHING under a directory, I can't remember the command line, but I need something like that.
In this case you want a Terminal command, not a DOS command. "DOS" and "command-line" or "terminal" are not interchangeable.

DOS is a specific operating system -- well, a group of operating systems -- which has nothing to do with Mac OS.

fwiw, if you want the final result to be sortable, I'm sure you could play around with importing the doc into Numbers or Excel and playing with that...
 
Type 'ls -R > filelist'

I'd like to accomplish something like this, but the formatting of the resultant file is not what I want.

I want to create a text file formatted with the full path of each file on different lines

e.g.

/Users/User/Documents/FolderA/file1.doc
/Users/User/Documents/FolderA/file2.doc
/Users/User/Documents/FolderB/file3.doc

etc

I don't want any information about the files, just a list of full path names.
Can the terminal command be altered to do this?

Also, is there a simple app that does this sort of thing? I'm not good at remembering terminal commands and syntax.
 
/Users/User/Documents/FolderA/file1.doc
/Users/User/Documents/FolderA/file2.doc
/Users/User/Documents/FolderB/file3.doc
Assuming the User in the above is your actual user name, try this:
Code:
find ~/Documents -type f >~/Desktop/docs.txt
The output will be in the text file "docs.txt", located on your desktop.

If the above doesn't produce the output you want, then post a sample from the actual docs.txt file, and explain why it's not what you want. If the above produces an error message, copy and paste the actual text of the message into a reply.


Also, is there a simple app that does this sort of thing? I'm not good at remembering terminal commands and syntax.
Copy the above command to the clipboard. Paste it into a Terminal.app window. It runs, producing output in docs.txt on your desktop.

Then open a new file in TextEdit.app. Paste the command into that window. Save as "Commands for listing Documents folder".
 
How do you exclude hidden files? I am getting .DS_Store in the output
Try this.
Code:
find ~/Documents -type f -not -name '.*' >~/Desktop/docs.txt
It excludes all files whose name starts with dot. This will match (and thus exclude) files other than ".DS_Store".

It will not exclude files that are hidden because they have their 'hidden' flag set. If you don't know what the hidden flag is, this shouldn't be a problem.
 
Try this.
Code:
find ~/Documents -type f -not -name '.*' >~/Desktop/docs.txt

Thanks, that did the job. I also managed to do it by creating an automator workflow that prompts me to select the folder I want to create a listing for. The actions I used were:
1. ask for finder items (folder option)
2. get folder contents (with repeat for each subfolder option invoked)
3. new text file
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.