I have attached my assignment, the goal is to create class Item with class FIle and class Directory inheriting from class Item. I need to be able to create directory file objects, store them in a list and recursively display them to user after creating 3 directories and 3 files per director. Using Python objects only, do not use the unix commands to actually make the files directories, just the python object relationship between them
Lab 6 & 7 Python Objects CSCI 344 Shell Programming Lab 6 due by Friday March 4, 11:59pm Lab 7 due by Friday March 11, 11:59pm 30 points each lab Overview Objects are used HEAVILY with Python. The goal of this assignment is to create a Python-based multi-level File System to manage files and directories. It is not necessary to create the actual physical structure. Only create the objects and their relationships. You should first have an Item Class with variables name, parentdir, and permissions. Then, to create objects from the File and Directory sub-classes. The sub-classes are supposed to inherit the attributes from the Item class. Start by running the sample code on the last page below. The domain of the specific attributes are as follows: 1. File: Size with domain of Small, Medium, and Large 2. Directory: UpdDate containing the last updated date An example run of your program should look something like this: Welcome to Python's File System dir = [ ] Directory File name parentdir Size UpdDate permissions Item -------------------------------- Main Menu: 1. Create a File 2. Create a Directory 3. Remove a File/Directory 4. Display File System 5. Exit Choice: 1 Please enter a File name or quit: myfile Please enter a parent directory or quit: /etc ERROR: Parent Directory Does not Exist Please enter a parent directory or quit: quit Main Menu: 1. Create a File 2. Create a Directory 3. Remove a File/Directory 4. Display File System 5. Exit Choice: 2 Please enter Directory name or quit: /etc Please enter a parent directory or quit: / Please enter access permissions using format rwx or quit: -wx Created Directory: /etc Main Menu: 1. Create a File 2. Create a Directory 3. Remove a File/Directory 4. Display File System 5. Exit Choice: Exit ERROR: Try again: 1 Please enter File name or quit: myfile Please enter a parent directory or quit: /etc Please enter access permissions using format rwx or quit: r-x Please enter size (1-Small, 2-Medium, 3-Large): 2 Created File: /etc/myfile BLAH BLAH BLAH Main Menu: 1. Create a File 2. Create a Directory 3. Remove a File/Directory 4. Display File System 5. Exit Choice: 4 /adir afile bfile cfile /bdir afile bfile /cdir bfile cfile9 Main Menu: 1. Create a File 2. Create a Directory 3. Remove a File/Directory 4. Display File System 5. Exit Choice: 5 Goodbye! ------------------ More Specifications a. The Display File System choice should print the directories and files interleaved in alphabetical order. Indent the files for better readability. The output submitted should include at least 3 directories and each directory should have at least 3 files (example shown above). b. Files can only be created if parent directory exists. c. To simplify your design, all items can be assumed to have a parent directory; therefore, no files are required to be created in root / directory. Assume the root / directory always exists. d. The UpdDate attribute for directories is updated from the system time at creation time or when files within the directory are updated. e. Access permissions are entered using the format rwx and a dash - indicates no access. For example, r-x specifies only read and execute access. f. Duplicate directory/file names are not allowed within same directory. Lab 6 Deliverables 1) Code should at least be able to create one type of item. The directory item type is probably easier since a parent directory is not required. Files cannot be placed in root directory. 2) Code should display all items created. Any order/format is OK for this Lab 6 but not Lab 7. 3) Full code listing. If the code does not all fit in a single screen shot then, it will need to be copied into your document as text so that it is neatly in a continuous listing. 4) Full output listing. Multiple screen shots are OK but, please make sure each screen shot is clearly labeled with its purpose. 5) For your conclusion, include what was the most difficult step and how was it tackled. Lab 7 Deliverables 1) Complete all the specifications listed above. 2) Full code listing. If the code does not all fit in a single screen shot then, it will need to be copied into your document as text so that it is neatly in a continuous listing. 3) Full output listing. Multiple screen shots are OK but, please make sure each screen shot is clearly labeled with its purpose. 4) For your conclusion, include what was the most difficult step and how was it tackled. Grading: To achieve a maximum score, students will need to clearly prove that they completed the goal. A clear description of the steps taken, and screen shots are essential. Partial credit is given if students can clearly state what was done and what is not working. If the instructor is required to decipher incompleteness, much less partial credit will be given. Points lost for incompleteness, sloppiness, lateness, or failure to follow instructions. Late policy: refer to syllabus Sample code: Save the following into a file named property.py # filename : property.py class Property : def getValue(self): return self._value def click(self): self._value = self._value + 1 def reset(self): self._value = 0 Save the following into a file named mainproperty.py #!/usr/bin/python3.5 # filename : mainproperty.py from property import Property tally = Property() tally.reset() tally.click() tally.click() result = tally.getValue() print("Value:",result) tally.click() result = tally.getValue() print("Value:", result) Run the chmod command on mainproperty.py to executable and execute it