For whatever purpose, the script's role is to generate a directory-tree-structured text file that supports Chinese and file directory names with spaces. Like what
$./gdt.sh/cygdrive/e/ccccc-o
Ccccc.txt The/CYGDRIVE/E/CCCCC directory tree structure text file. If there is no directory name parameter, the current directory tree is generated.
This script completes programming with bash and does not use SED, awk, and so on.
The specific usage and option implications can be used to display simple help, or see the end of the article source code:
$./gdt.sh-h
The directions are as follows:
usage:gdt.sh [-h] [-o [file name]] [-n] [directory]
Generate directory tree.
|--For file,/--for empty directory, +--for Non-empty directory.
Options:
-H help page, any other options ignored
-O output results to a file, no file name follwed means output file has a name same as directory.
-N No screen output, if no file specificed, it redirects to/dev/null
All extra arguments would be ignored automatically.
Only the ' only ' is considered if more exist.
GDT source code and generate file samples