Question
Hello I need help for this Java homework: A Recursive Directory Search Utility for Windows This assignment combines recursion, looping and advanced file handling in
Hello
I need help for this Java homework:
A Recursive Directory Search Utility for Windows
This assignment combines recursion, looping and advanced file handling in a practical application for the Windows operating systems file structure.
This assignment asks you to create a Java program that brings recursion, looping, file handling techniques and (optionally) advanced file date processing together in a useful Windows application. Your program will prompt the user for search criteria and will then crawl through a directory together with its subdirectories looking for files that qualify. Results of the search are displayed.
Your program should search for files:
* By name (without an extension e.g. MyTextFile)
* By extension name (e.g. java)
* By content (e.g. Math.sqrt)
* By modification date (optional extra credit see below) Notes:
* The above criteria for searching may be combined in any form (see example runs below.)
* A valid initial path will always be entered other criteria are optional.
* You should allow the user to find file name entries regardless of upper/lower case characters in the file and extension names.
* Searching for content, however, should be case sensitive.
* The count of qualifying files should be displayed (see example output.)
* Your class (and your corresponding .java file) should be named as follows: o MySearch
o Zip your .java file
Sample runs:
By extension and date:
Directory search by path, name, extension, content and date.
Enter starting directory for the search (like c:\temp): c:\temp
Enter the file name (like myFile or enter for all):
Enter the file extension (like txt or enter for all): txt
Enter content to search for (like cscd211 or enter for any):
Enter last modified date (like 11/21/2013 or enter for any): 11/1/2011
Results - 3 entries found:
c:\temp\Adobe\test.txt
c:\temp\x\test.txt
c:\temp\x\testx.txt
By name only:
Directory search by path, name, extension, content and date.
Enter starting directory for the search (like c:\temp): c:\eclipseprojects
Enter the file name (like myFile or enter for all): mysearch
Enter the file extension (like txt or enter for all):
Enter content to search for (like cscd211 or enter for any):
Enter last modified date (like 11/21/2011 or enter for any):
Results - 2 entries found:
c:\eclipseprojects\workspace\RecursionDirectorySearchAssignment\bin\MySearch.class
c:\eclipseprojects\workspace\RecursionDirectorySearchAssignment\src\MySearch.java
By extension, content and date:
Directory search by path, name, extension, content and date.
Enter starting directory for the search (like c:\temp): c:\ewu\cscd210
Enter the file name (like myFile or enter for all):
Enter the file extension (like txt or enter for all): java
Enter content to search for (like cscd211 or enter for any): Math.sqrt
Enter last modified date (like 11/21/2011 or enter for any): 1/1/2009
Results - 5 entries found:
c:\ewu\cscd210\Distance.java
c:\ewu\cscd210\LabTriangle.java
c:\ewu\cscd210\SieveOfEratosthenes.java
c:\ewu\cscd210\Test2.java
c:\ewu\cscd210\TestAra.java
In addition to the required search criteria, also provide the ability to search by date last modified. For this task, you would do well to take advantage of the Calendar class. Note the lastModified value for files is retained in milliseconds since 1/1/1970 (the beginning of computer time.)
Thank you.
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