We'll continue working with file IO and exception handling by building a simple text-based interface for browsing the file system.

When your program starts it should ask the user if they would like to dump results to a log file

IN ADDITION to standard out. If so, your program should prompt for the name of the log file.

If the file already exists, the contents should be overwritten.

The program will then display (6) options to the user:

  • List the contents of a directory provided by the user
  • List the contents of a directory provided by the user as well as all of its sub directories. (hint: use recursion)
  • Locate a file with a given name.
  • Locate files with a given file extension
  • Concatenate the contents of 2 files whose names are provided by the user and output the result to a third file (name also provided by the user)
  • Exit

You should refer to the File class API provided in the java.io package.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.