INFO1112Assignment1课业解析题意: 写一个类似linux里find命令的简化版本python脚本 解析: find命令能够让我们在文件系统空间中搜索满足某些条件的文件比如某些特定名称(完全匹配)、名称与正则表达式模式匹配的文件(部分匹配)。还需要实现显示搜索文件的某些特征(比如特定日期后者读写权限等),python可使用os.walk对目录进行遍历,还需对文件名和扩展名进行遍历,可将文件名和扩展名以列表呈现,查找时对列表进行遍历即可。当遇到无效的命令行参数时应进行错误处理。 涉及知识点: python编程,os.walk、re模块 更多可加微信讨论微信号:IT_51zuoyejunpdf
INFO1112 2019 Assignment 1Due Week 9, Monday 7th October at 11:59PM (Midnight)This assignment is worth 10% of your overall grade for the course.AssessmentThe assignment will be marked with an automatic testing system on Ed. Anautomatic mark will be given based on a percentage of tests passed (6%) and amanual mark will be given for overall style, quality, readability, etc (2%). You areexpected to write your own tests and submit them with your code, and a mark willbe given based on coverage and manual inspection of your tests (2%).Marks will be allocated for :● basic directory traversal● regular expression● executing external commands● argument parsing● test coverage● code layout, readability, overall quality, etcOther behaviours will not be assessed.This assignment involves writing a command to scan the file system looking for aname that matches a given regular expression and then executing anothercommand. It is to be developed using the Python language. The specification for thecommand is given below.INFO1112 2019 Assignment 1 1The Find CommandAll Unix-like systems (Linux, etc) have a command called “find”. This commandallows you to search the file system name-space for a file that satisfies some criteria.For example, you might search for a file with a particular name (exact match), or youmight search for a file with a name that matches a regular expression pattern. Youmight search for a file that has certain characteristics such as created after aparticular date or has certain permissions (eg writable).You can see the detailed specification of this command using the Unix mancommand, eg ” man find “.Assignment SpecificationYou are to implement a very simplified version of the Unix find command.The syntax for your command is:myfind.py [–regex=pattern | –name=filename] directory [command]myfind.pyis the command namedirectoryis a required argument for the path to the directory to traversefilenameis the exact filename to match against when traversing the directorypatternis the regular expression pattern to match against when traversing thedirectoryOnly one of –regex=patternor –name=filenameshould be provided. Ifneither are provided, then list all files found during the traversal. These flags may belocated anywhere in the argument list.commandis an optional argument which is a Unix command that has {}in thecommand string replaced by the file name that is currently being executed on. If thisargument is not provided, then just list the file paths of the discovered files. Thisstring should be a simple command with an argument list (e.g. no redirections orpipes).Error handling and assumptionsIf invalid command line arguments are provided, your program should output thefollowing to standard error and exit with a non-zero exit code.Usage: myfind.py [–regex=pattern | –name=filename] directory[command]INFO1112 2019 Assignment 1 2If any of the child processes could not be started, your program should print thefollowing to standard error and exit with a non-zero exit code. An example isprovided in the last usage example.Error: Unable to start process ‘