Directory Tree

Assignment 5

Directory Tree

EEL 4854

In this assignment, students are required to implement an operating system command

that displays the tree structure of a folder or directory. The program asks the

user to enter a folder name. Next, the program traverses the tree hierarchy of this folder in a preorder traversal to retrieve the children folders or files in the specified folder. As the hierarchy is being traversed, the names of the subfolders or files are being displayed in an indented fashion where the amount of indentation reflects the hierarchy level of the displayed subfolders or files. This command should produce an output similar to the tree command in the DOS operating system. The figure below shows a display of a partial output of the tree command. Students can experiment with this command by typing

tree | more

The Java API provides the File class which can be used to implement this assignment.

Submission

This assignment is due by the date above. Only the source code file should be turned in following the same instructions as for Assignment 1.

 

 

    • 10 years ago
    A+ Work
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      directorytree.zip