Weeks 4 - System Programming And Automation Assignment
For this assignment, you are going to write a basic file management script to the following specifications:
Your file manager needs to take command-line arguments. One of the arguments (m) will be the mode the script needs to run in - basic, elevated, and admin. This argument is required; without it, the program should terminate.The other argument your program should take (-d) is optional and should be a directory path where you wish to browse files. If provided, your script will open that directory by default. If not, your script should open the default folder where it runs scripts.
Your command-line arguments should be able to be accepted in any order. You need to ensure that no bad -m values get put in and that provided directory paths do not contain dot-dot folders.
When your script loads, offer the user a menu of different things they can do.
1) In basic mode, your script should allow the users to change the current directory to one of their choosing (you will need to prompt for this) and list items in the current directory only. When you list items, please include file size and distinguish between directories and files.
2) In elevated mode, your script should allow users to do all of the above, plus be able to copy files and directories from one place to another (you will again need to prompt the user for details on how to accomplish this).
3) In admin mode, your script should allow users to do all of the above, plus be able to move and delete files and directories (again, prompt the user for any
details needed in order to make these operations work properly).
Your script must log all commands to a file off the root of your working hard drive to a file called "system_log.txt" that's stored in a folder called "Python_Log". So, if you are working in Windows, your file would be stored at C:\Python_Log\system_log.txt You do not need to get overly granular here. If you are copying a file, just say "<name of the file> was copied to <destination>". If a directory was copied, just say "<name of the directory> was copied to <destination>". In the case where a directory is copied, you don't need to list the individual files that were copied...just the name of the folder.
For any delete operation, you need to first copy whatever you're deleting to a folder off the root of your working hard drive to a folder called "backups". Then, once you've copied everything over, rename each file\directory so that the names are prefixed by "deleted_". Thus a file named "file.txt" would be renamed to "deleted_file.txt".
Details on the above instructions are as follows:
Your program must include appropriate error checking to make sure the source and destination folders do/don't exist as appropriate, as well as handle any other potential errors.
If the destination folder doesn't exist when performing an operation, your program must block the operation and ask the user to try again.
Your script must be designed to work equally well on Windows, Mac, and Linux platforms.
The rest of your implementation details are up to your discretion, applying the things you
have learned about Python so far. Please note, however, that you must organize any
classes\functions you create into modules and produce documentation (using Pydoc) for
your work using the principles discussed earlier in the class. You do not need to create test cases.
Be sure to put comments in your code that clearly mark how you are performing your
program logic. In the submission comments of this assignment, please place the repository URL of your file submission.
Are you looking for Python Programming Assignment Help? Codersarts python developer experts offer the best quality Python programming, coding or Python programming Tutors. Get Python Assignment Help at an affordable price from the best professional tutors Assignment Help. Order now at get 15% off.
コメント