[Cialug] Printing Directories

Chris Freeman cwfreeman at gmail.com
Thu Dec 3 22:00:44 CST 2009


'find -type d' won't find the files, only the directories. Also, if
you want a tree view, find isn't as efficient as tree.

I think this is a better

find | sed "s/[^\/]*\//\t/g"

If you want to match tree's output, this comes pretty close (but is
not perfect):

find . -name '.' -print -o -name '.*' -prune -o -print | sed
"s/[^\/]*\//|   /g" | sed "s/| *\(\w\)/|-- \1/g"

Chris



On Wed, Dec 2, 2009 at 11:32 PM, Daniel A. Ramaley
<daniel.ramaley at drake.edu> wrote:
> find -type d
> should also work.
>
> On 2009-12-02 at 23:03:29, Jim Asbille wrote:
>>Well here is the answer.  I installed Tree then ran* tree -d >
>> print.txt*. Worked like a charm.
>>
>>Jim Asbille, MSM
>>registered Linux user number 388067
>>
>>"Failure is not an option.  It's a standard feature of Windows and is
>>bundled into the Operating System for your convenience, at no
>> additional charge."
>>
>>On Wed, Dec 2, 2009 at 9:37 PM, Jim Asbille <jim.asbille at gmail.com>
> wrote:
>>> Here is a simple question that I hope someone has an answer for.  I
>>> have a directory called mp3 with all of my music in it.  I want to
>>> generate a file that lists the directories and sub-directories but
>>> not the files.
>>>
>>> I have used *ls -R > print.txt* but that generates a 597 page
>>> document since it prints every song and image.  I just want the
>>> Artist level Directories and the Album Level Directories to print to
>>> a file.
>>>
>>> Directory Structure
>>> mp3
>>>    *Artist
>>>       Album*
>>>          Files
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> Jim Asbille, MSM
>>> registered Linux user number 388067
>>>
>>> "Failure is not an option.  It's a standard feature of Windows and
>>> is bundled into the Operating System for your convenience, at no
>>> additional charge."
>>
> --
> Daniel A. Ramaley
> Network Engineer 2
>
> Dial Center 118, Drake University
> 2407 Carpenter Ave / Des Moines IA 50311 USA
> Tel: +1 515 271-4540
> Fax: +1 515 271-1938
> E-mail: daniel.ramaley at drake.edu
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list