Question
-To be done in UNIX shell Bash scripting In many command line interfaces, there is a command called tree that either already exists or you
-To be done in UNIX shell Bash scripting
In many command line interfaces, there is a command called tree that either already exists or you can download via a package manager. Delmar doesn't let us do that, unfortunately, so we'll have to build our own.
For this project, your goal is to create a command line tool that takes in a directory, and prints all of its subdirectories in a formatted fashion. For example, suppose I pass in a directory with its own subdirectories for a project:
example-app |-- pom.xml |-- src | |-- main | | `-- java | | `-- main | | |-- App.java | | `-- DoMath.java | `-- test | `-- java | `-- main | |-- AppTest.java | `-- DoMathTest.java `-- target |-- classes | |-- DoMath.class | `-- main | `-- App.class |-- generated-sources | `-- annotations |-- generated-test-sources | `-- test-annotations |-- maven-status | `-- maven-compiler-plugin | |-- compile | | `-- default-compile | | |-- createdFiles.lst | | `-- inputFiles.lst | `-- testCompile | `-- default-testCompile | |-- createdFiles.lst | `-- inputFiles.lst |-- surefire-reports | |-- DoMathTest.txt | |-- TEST-DoMathTest.xml | |-- TEST-main.AppTest.xml | `-- main.AppTest.txt `-- test-classes |-- DoMathTest.class `-- main `-- AppTest.class
Your application should be able to:--
-
Determine the filetype of what is passed in, and throw an error / exit if not a directory.
-
Print a tree of the file hierarchy of the supplied directory's subdirectories and files.
Bonus points: Colorize your output to distinguish between ordinary files and directories.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started