留学生辅导 - ICS 32 - Project 1 - File System
编辑ICS 32 - Project 1
Project Title: File System Explorer
Due Date: Monday, 2/3/25, 11:59 pm
Checkpoint: Monday, 1/27/25
Project Overview
This assignment requires you to create a File System Explorer tool that operates via a command-line interface. The goal is to build an interactive tool that can inspect folders and display their contents based on user commands.
General Structure
Your program will accept user input in the following formats:
[COMMAND]
[COMMAND] [INPUT]
[COMMAND] [-OPTIONS] [INPUT]
[COMMAND] [-OPTIONS] [INPUT] [OPTION_INPUT]
You must implement the following 4 commands:
Commands Overview
1. man
Command
-
Purpose: Displays text on how to use the specified command.
-
Valid Format:
[COMMAND] [INPUT]
-
Example:
man cat
→ Displays how to use thecat
command.
-
Errors:
- If no command or an invalid command is provided, print:
ERROR: Invalid Command.\n
- If incorrect arguments are provided, print:
ERROR: Invalid Format.\n
- If no command or an invalid command is provided, print:
2. ls
Command
-
Purpose: Lists the contents of a directory, sorted by files first, followed by directories. The output must be hierarchical.
-
Valid Format:
[COMMAND] [INPUT]
[COMMAND] [-OPTIONS] [INPUT]
[COMMAND] [-OPTIONS] [INPUT] [OPTION_INPUT]
-
Options:
-r
: Recursive listing, including subdirectories.-f
: Files only (excludes directories).-s [FILENAME]
: Matches files with a specific name.-e [EXT]
: Filters by file extension.-g [SIZE]
: Lists files greater than a specified size (bytes).-l [SIZE]
: Lists files smaller than a specified size (bytes).
-
Exceptions:
- If an invalid path is provided or it's not a directory, print:
ERROR: Invalid Path.\n
- For invalid formats or incorrect arguments, print:
ERROR: Invalid Format.\n
- If an invalid path is provided or it's not a directory, print:
3. cat
Command
-
Purpose: Prints the contents of a file.
-
Valid Format:
[COMMAND] [INPUT]
[COMMAND] [-OPTIONS] [INPUT]
-
Options:
-f
: Prints only the first line.-d
: Duplicates the file by creating a.dup
copy.
-
Exceptions:
- If the path is invalid or not a file, print:
ERROR: Invalid Path.\n
- For invalid format or arguments, print:
ERROR: Invalid Format.\n
- If the path is invalid or not a file, print:
4. q
Command
-
Purpose: Quits the File System Explorer.
-
Valid Format:
[COMMAND]
-
Exceptions:
- For invalid format or incorrect arguments, print:
ERROR: Invalid Format.\n
- For invalid format or incorrect arguments, print:
Other Commands
- Empty string: If the user submits an empty string, simply print the empty string.
- Invalid command: If any other command is given, print:
ERROR: Invalid Command.\n
Program Requirements
Main and parse_command
Functions
- Implement the
parse_command
function to handle the user input and return the appropriate string response (or "quit" for theq
command). - Do not modify the
main
function; it will be responsible for printing the response returned byparse_command
.
Error Handling
- Any
IOError
exceptions should be caught where they are raised. - Handle cases where users input an invalid file path, directory, or command.
Incremental Development
- Track your progress by making frequent submissions to Gradescope.
- Submit before the checkpoint day of Monday, 10/14/24, 9:00 am, with more than 50% points to avoid mandatory lab attendance.
Style and Exceptions
- Follow Python coding style (using
pycodestyle
). - Include error handling to prevent crashes from invalid user inputs.
- Document your code clearly.
Hints
- You may reuse code from the File Systems Lab to help with the implementation.
Submission Instructions
- File: Submit your code in the
project1.py
file. - Documentation: Provide a description of the high-level design of your program in the comment section at the top of the
project1.py
file.
Late Submission
- Penalty: Late submissions are allowed within 3 days of the deadline, with a penalty of 8% per day.
This project will help you develop foundational skills for working with file systems and handling user inputs via the command line, which is a vital skill in programming and system administration.
联系我们
WeChat:pythonyt001
Email: [email protected]
留学生作业辅导,留学生Python辅导,留学生Python代写,CS代写,Java代写,R语言代写,Assignment代写,Project代写,英国留学生,澳洲留学生,马来西亚留学生,法国留学生,美国留学生,新加坡留学生,日本留学生,韩国留学生等各国均可,各种代写。
- 0
-
分享