Skip navigation

is there a way to copy list of all folders sub folders 10.8.2

1838 Views 20 Replies Latest reply: Dec 23, 2012 1:03 AM by Benway1 RSS
1 2 Previous Next
Benway1 Level 1 Level 1 (0 points)
Currently Being Moderated
Dec 8, 2012 6:21 PM

Pretty much as the title says :

 

I was wondering if there was a way to copy a list of all the names of folders sub folders 10.8.2

into a text file / text files ?

 

I know I can select folders and files and command+c then paste them into a text file,

but this only works on the contents a single folder .

I want to be able to export as a text file the list of all folders and subfolders within, as I said.

 

It will be  a very long text file, but I would "need" this feature.

Would help me enormously.

 

Thanks.

MacBook Pro (15-inch Late 2011), OS X Mountain Lion (10.8)
  • Courcoul Level 6 Level 6 (11,180 points)

    Are you game for learning a little Unix and knowing your Mac a little deeper? If you are, do know that OS X is Unix under the pretty graphics and regular Unix commands work just fine in Terminal.

     

    So look up Terminal in Utilities and start it. A blank window will open and the command line prompt will await you at the bottom. First, try out the following Unix command to see if the results are what you want (type the following exactly, then press Enter/Return):

     

    ls -R

     

    If it is good, you will have to navigate to the topmost directory you want the list from. The -R (Recurse) option takes care of recursing down the tree. Use the cd command to change from the default (your home folder) to wherever you need to go. In Unix you separate directories with the / For example, the Utilities folder is in /Applications/Utilities and you can navigate to it by typing:

     

    cd /Applications/Utilities

     

    Can determine the names of all intervening folders by opening a Finder window to the desired place and Command-clicking on its name.

     

    Holler if you need more help.

  • Courcoul Level 6 Level 6 (11,180 points)

    The entire contents of the Terminal window is just text. Just as you'll be able to click-drag to select the ls output and copy it over to wherever you need it, so can you copy a folder PATH (starting from /) and paste it into the command line.

     

    I usually keep a TextEdit window open alongside Terminal's as a cache holder for file paths and such.

  • Niel Level 10 Level 10 (234,855 points)

    Drag the folder into the Terminal window to fill out its path, or into TextWrangler to put a listing of its contents into the TextWrangler document.

     

    (72548)

  • Topher Kessler Level 6 Level 6 (9,305 points)

    You might find the "tree" command and other options in this article useful: http://reviews.cnet.com/8301-13727_7-10402034-263.html

  • Courcoul Level 6 Level 6 (11,180 points)

    Oh, yeah, had forgotten the "drag the folder onto the Terminal" shortcut.

     

    Hey, Benway, sorry dude! Once you get addicted to the Terminal you'll never want to quit...

  • Topher Kessler Level 6 Level 6 (9,305 points)

    If you use the "tree" command in that article, you can use the -d flag to have it list only directories. For instance, to list only directories on your desktop folder you would enter the following:

     

    tree -d ~/Desktop/

     

    This can also be output to a text file by redirecting the output like the following command:

     

    tree -d ~/Desktop/ > ~folders.txt

     

    This will create a file called "folders.txt" in your home directory that contains the output of the "tree" command so you can open it in other applications and print or otherwise manage it.

  • Topher Kessler Level 6 Level 6 (9,305 points)

    That command is a terminal command. If you copy the desktop folder and paste it into TextWrangler you will copy its name only; however, if you drag it to the TextWrangler window you will insert its full directory and file struture into the document.

1 2 Previous Next

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.