Shell script generates a directory tree structure text file--Snippets

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.