- Joined
- Aug 10, 2012
- Messages
- 1
- Reaction score
- 0
You must complete all the following tasks:
• Display a welcome message and a menu of operations (see below).
• Assume the current folder is always "C:\Windows"
• Prompt the user to select one of the operations:
1. Full File Listing: Display the filenames and lengths of all the files in the current folder. The format for the directory listing should be like this:
Files in: C:\Windows
File 1: explorer.exe : Filesize:2871808
File 2: ODBC.ini : Filesize:376
File 3: winhlp32.exe : Filesize : 9728
...
2. Filtered File Listing: ask the user to enter one of "exe", "ini" or "log". Display only the files in the current folder that match that filter. The display should be formatted in the same way as the full file listing, except you should also display the filter used.
Tip: This is fairly straightforward - when you use the method GetFiles you can pass it a filter string, e.g: GetFiles("*.exe")
3. Folder Statistics: Display the following statistics about all the files in the current folder. Do not list any files in this case.
Files in: C:\Windows
Number of files in folder: 49
Smallest file: setuperr.log : 0 bytes
Largest file: explorer.exe : 2871808 bytes
Total size of all files: 7121424 bytes
4. Quit, to exit the program
• After each operation (except 4) is complete wait for the user to press a key to continue, displaying an appropriate message to this effect. After the key press, the program should clear the screen, then return to the welcome message and the user may select another operation.
• Your program must validate user input:
o Check for mistakes in the user input and in each case display an error message and allow the user to provide the input again
o For example, on the main menu the user is given the options 1, 2, 3 or 4. If the user enters 7, then display “Sorry, you must enter 1,2,3 or 4” and then allow the user to make a choice again
• Display a welcome message and a menu of operations (see below).
• Assume the current folder is always "C:\Windows"
• Prompt the user to select one of the operations:
1. Full File Listing: Display the filenames and lengths of all the files in the current folder. The format for the directory listing should be like this:
Files in: C:\Windows
File 1: explorer.exe : Filesize:2871808
File 2: ODBC.ini : Filesize:376
File 3: winhlp32.exe : Filesize : 9728
...
2. Filtered File Listing: ask the user to enter one of "exe", "ini" or "log". Display only the files in the current folder that match that filter. The display should be formatted in the same way as the full file listing, except you should also display the filter used.
Tip: This is fairly straightforward - when you use the method GetFiles you can pass it a filter string, e.g: GetFiles("*.exe")
3. Folder Statistics: Display the following statistics about all the files in the current folder. Do not list any files in this case.
Files in: C:\Windows
Number of files in folder: 49
Smallest file: setuperr.log : 0 bytes
Largest file: explorer.exe : 2871808 bytes
Total size of all files: 7121424 bytes
4. Quit, to exit the program
• After each operation (except 4) is complete wait for the user to press a key to continue, displaying an appropriate message to this effect. After the key press, the program should clear the screen, then return to the welcome message and the user may select another operation.
• Your program must validate user input:
o Check for mistakes in the user input and in each case display an error message and allow the user to provide the input again
o For example, on the main menu the user is given the options 1, 2, 3 or 4. If the user enters 7, then display “Sorry, you must enter 1,2,3 or 4” and then allow the user to make a choice again