Home > itblogs > Как быстро посмотреть структуру директорий?

Как быстро посмотреть структуру директорий?

January 19th, 2009

Навигация в командной строке, в отличие от оной в GUI, как правило, быстра, но не наглядна. Сделать этот процесс чуть более наглядным помогает утилита “tree.exe”. Назначение этой утилиты – показать иерархию каталогов и, если нужно, – файлов в виде наглядного дерева.

Например:

d:\fardev>tree
Folder PATH listing for volume data
Volume serial number is D21C-626A
D:.
├───addons
│   ├───Archivers
│   ├───Colors
│   │   ├───Custom Highlighting
│   │   └───Default Highlighting
│   ├───Macros
│   ├───SetUp
│   ├───Shell
│   ├───Tables
│   │   ├───Central European
│   │   ├───Cyrillic
│   │   │   └───E-Mail Double Conversion
│   │   ├───Hebrew
│   │   └───Western European
│   └───XLat
│       └───Russian
├───bin
│   ├───misc
│   │   └───lng
│   │       └───msvc-9.0
│   │           └───amd64fre
│   │               └───exception-handling-off
│   │                   └───threading-multi
│   └───unicode_far
│       └───msvc-9.0
│           └───amd64fre
│               ├───exception-handling-off
│               │   └───threading-multi
│               └───threading-multi

Параметры tree.exe особых пояснений не требуют:

d:\fardev>tree /?
Graphically displays the folder structure of a drive or path.

TREE [drive:][path] [/F] [/A]

   /F   Display the names of the files in each folder.
   /A   Use ASCII instead of extended characters.
  1. January 19th, 2009 at 23:52 | #1

    Старая добрая tree, знакомая еще со времен DOS =)

  2. tbl
    January 20th, 2009 at 01:41 | #2

    Если бы в консоли изначально (во времена доси) сделали нормальное автодополнение, как в bash (а еще лучше, как в zsh), то потребность в таких утилитах отпала бы.

  3. Pavel
    January 20th, 2009 at 02:51 | #3

    Точно!
    а я уж и забыл :-)
    а раньше я знал об этой команде.

  4. January 20th, 2009 at 07:16 | #4

    Еще удобно вывод tree перенаправлять в файл и уже там разглядывать.
    tree > tree.txt
    Удобно если дерево большое.

  5. January 20th, 2009 at 07:21 | #5

    Если бы в консоли изначально (во времена доси) сделали нормальное автодополнение, как в bash (а еще лучше, как в zsh), то потребность в таких утилитах отпала бы.

    Не, я так не думаю. Автодополнение и tree используются для немного разных целей. Вот нормальное бы автодополнение не помешало бы – это факт.

  6. zeroes
    January 23rd, 2009 at 09:07 | #6

    А ещё удобнее в FAR’e нажать Ctrl-T

    но я этой фичей не пользуюсь всё равно.

  7. Anonymous
    January 25th, 2009 at 08:00 | #7

    anon:~$ tree –help
    usage: tree [-adfgilnpqrstuxACDFNS] [-H baseHREF] [-T title ] [-L level [-R]]
    [-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes]
    [--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]
    []
    -a All files are listed.
    -d List directories only.
    -l Follow symbolic links like directories.
    -f Print the full path prefix for each file.
    -i Don’t print indentation lines.
    -q Print non-printable characters as ‘?’.
    -N Print non-printable characters as is.
    -p Print the protections for each file.
    -u Displays file owner or UID number.
    -g Displays file group owner or GID number.
    -s Print the size in bytes of each file.
    -D Print the date of last modification.
    -F Appends ‘/’, ‘=’, ‘*’, or ‘|’ as per ls -F.
    -r Sort files in reverse alphanumeric order.
    -t Sort files by last modification time.
    -x Stay on current filesystem only.
    -L level Descend only level directories deep.
    -A Print ANSI lines graphic indentation lines.
    -S Print with ASCII graphics indentation lines.
    -n Turn colorization off always (-C overrides).
    -C Turn colorization on always.
    -P pattern List only those files that match the pattern given.
    -I pattern Do not list files that match the given pattern.
    -H baseHREF Prints out HTML format with baseHREF as top directory.
    -T string Replace the default HTML title and H1 header with string.
    -R Rerun tree when max dir level reached.
    -o file Output to file instead of stdout.
    –inodes Print inode number of each file.
    –device Print device ID number to which each file belongs.
    –noreport Turn off file/directory count at end of tree listing.
    –nolinks Turn off hyperlinks in HTML output.
    –dirsfirst List directories before files.
    –charset X Use charset X for HTML and indentation line output.

    Даже HTML дерево можно создать.

Comments are closed.