Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java only: Write a method crawl accepts a File parameter and prints information about that file. If the File object represents a normal file, just

java only:

Write a method crawl accepts a File parameter and prints information about that file.

If the File object represents a normal file, just print its name.

If the File object represents a directory, print its name and information about every file/directory inside it, indented.

cse143

handouts

syllabus.doc

lecture_schedule.xls

homework

1-sortedintlist

ArrayIntList.java

SortedIntList.java

index.html

style.css

recursive data: A directory can contain other directories.

  • Your program should accept zero or more command-line arguments.
  • It should interpret each command-line argument as a (relative or absolute) pathname,
  • create a File object corresponding to this pathname, and
  • invoke the crawl method on this object,
  • which then prints the properly indented file/directory tree as shown on slide 34.

In addition,

  • if there is no file corresponding to the given pathname, your program should still print the pathname followed by "[not found!]"
  • if there is a file corresponding to the given pathname, your program should print the pathname followed by "[filesize"] where "filesize" is the size in bytes
  • if the pathname corresponds to a directory, your program should print a (forward) slash after the pathname

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle9i Database Administration

Authors: Sam R. Alapati

1st Edition

1590590228, 978-1590590225

More Books

Students also viewed these Databases questions