4 added 3 characters in body
source | link

This is a bash function that output the names found in a top directory recursively:

mytree () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    # output directory name
    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            # output symbolic link name and target
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink -- "$name" )"
        elif [ -d "$name" ]; then
            # recurse into directories
            mytree "$name" "$indent"
        else
            # output other type of name (not directory or symbolic link)
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function mytree takes one argument (the second argument is only used in recursive calls) which is the top directory to process. If no arguments are given, it will use the current directory as the top directory to list.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

That is, names are quoted with single quotes and directories will have a trailing /. In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the three printf calls.

This is a bash function that output the names found in a top directory recursively:

mytree () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    # output directory name
    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            # output symbolic link name and target
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            # recurse into directories
            mytree "$name" "$indent"
        else
            # output other type of name (not directory or symbolic link)
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function mytree takes one argument (the second argument is only used in recursive calls) which is the top directory to process. If no arguments are given, it will use the current directory as the top directory to list.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

That is, names are quoted with single quotes and directories will have a trailing /. In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the three printf calls.

This is a bash function that output the names found in a top directory recursively:

mytree () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    # output directory name
    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            # output symbolic link name and target
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink -- "$name" )"
        elif [ -d "$name" ]; then
            # recurse into directories
            mytree "$name" "$indent"
        else
            # output other type of name (not directory or symbolic link)
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function mytree takes one argument (the second argument is only used in recursive calls) which is the top directory to process. If no arguments are given, it will use the current directory as the top directory to list.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

That is, names are quoted with single quotes and directories will have a trailing /. In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the three printf calls.

3 added 432 characters in body
source | link

This is a bash function that output the names found in a top directory recursively:

printitmytree () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    # output directory name
    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            # output symbolic link name and target
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            printit# recurse into directories
            mytree "$name" "$indent"
        else
            # output other type of name (not directory or symbolic link)
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function mytree takes one argument (the second argument is only used in recursive calls) which is the top directory to process. If no arguments are given, it will use the current directory as the top directory to list.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

InThat is, names are quoted with single quotes and directories will have a trailing /. In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the twothree printf calls.

This is a bash function that output the names found in a top directory recursively:

printit () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            printit "$name" "$indent"
        else
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function takes one argument (the second argument is only used in recursive calls) which is the top directory to process.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the two printf calls.

This is a bash function that output the names found in a top directory recursively:

mytree () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    # output directory name
    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            # output symbolic link name and target
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            # recurse into directories
            mytree "$name" "$indent"
        else
            # output other type of name (not directory or symbolic link)
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function mytree takes one argument (the second argument is only used in recursive calls) which is the top directory to process. If no arguments are given, it will use the current directory as the top directory to list.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

That is, names are quoted with single quotes and directories will have a trailing /. In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the three printf calls.

2 added 432 characters in body
source | link

This is a bash function that output the names found in a top directory recursively:

printit () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            printit "$name" "$indent"
        else
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function takes one argument (the second argument is only used in recursive calls) which is the top directory to process.

The output is like the following:

'build''Work'/
    'gitflow''Data'/
        'AUTHORS''s3wes.all.tab.frq.counts'
        'Changes's3wes.mdown'con.tab.frq.counts'
        'LICENSE''sullivan.txt'
        'Makefile''Development'/
        'README.mdown''ENA-submission'/
        'bump-version'
        'contrib''.git'/
            'gitflow-installer.sh'
            'msysgit-install.cmd''COMMIT_EDITMSG'

etc.

In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the two printf calls.

This is a bash function that output the names found in a top directory recursively:

printit () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob

    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -d "$name" ]; then
            printit "$name" "$indent"
        else
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function takes one argument (the second argument is only used in recursive calls) which is the top directory to process.

The output is like the following:

'build'/
    'gitflow'/
        'AUTHORS'
        'Changes.mdown'
        'LICENSE'
        'Makefile'
        'README.mdown'
        'bump-version'
        'contrib'/
            'gitflow-installer.sh'
            'msysgit-install.cmd'

etc.

The output format can easily be changed by changing the two printf calls.

This is a bash function that output the names found in a top directory recursively:

printit () (
    topdir="${1-.}"
    indent="${2-0}"

    shopt -s nullglob
    shopt -s dotglob

    printf "%${indent}s'%s'/\n" "" "${topdir##*/}"

    indent=$(( indent + 4 ))

    for name in "$topdir"/*; do
        if [ -h "$name" ]; then
            printf "%${indent}s'%s' --> '%s'\n" "" "${name##*/}" "$( readlink "$name" )"
        elif [ -d "$name" ]; then
            printit "$name" "$indent"
        else
            printf "%${indent}s'%s'\n" "" "${name##*/}"
        fi
    done
)

The function takes one argument (the second argument is only used in recursive calls) which is the top directory to process.

The output is like the following:

'Work'/
    'Data'/
        's3wes.all.tab.frq.counts'
        's3wes.con.tab.frq.counts'
        'sullivan.txt'
    'Development'/
        'ENA-submission'/
            '.git'/
                'COMMIT_EDITMSG'

etc.

In addition, symbolic links will be shown as, for example,

'embl-validator.jar' --> 'embl-api-validator-1.1.158.jar'

The output format can easily be changed by changing the two printf calls.

1
source | link