Question: Problem 3 (20 points): Implement a recursive function search that takes as parameters the name of a folder. The function returns a list of all
Problem 3 (20 points): Implement a recursive function search that takes as parameters the name of a folder. The function returns a list of all the files in the folder and sub folders that contains the value passed in as the second parameter. Please note that your function must work as described on any directory structure, not just the one provided as an example. You must use recursion to go through the subfolders. You may not use python crawlers or apis (walk) other than the ones used in the antivirus-redux example to find files in sub directories. Doing so will be an automatic 0 for this problem. You may use a for loop to loop through the contents of a folder. The content is case sensitive. The following illustrates several searches using a sample set of folders and directories located in the zip file containing the exam template. You don't need to worry about punctuation, case or file error handling for this problem. I >>> print('SEARCH: ', search('Test','assign) SEARCH: >>> print(' SEARCH: ', search (Test-2', 'e')) SEARCH: ('Test-2\\file2.txt', 'Test-2\\file3.txt', 'Test-2\\Testi\\Test1-A\\filel.txt', Test-2\\Testi\\Testi-B\\Test1-B-B\\file3.txt', 'Test-2\\Testi\\Test1-c\\c3\\fi le3.txt', 'Test-2\\Test2\\B\\B1-1\\B2-2\\\\B\\file2.txt', 'Test-2\\Test3\\A\\\ \file1.txt', 'Test-2\\Test3|\A\\B\\file2.txt', 'Test-2\\Test3|\A\\file2.txt', 'T est-2\\Test3\\A\\file3.txt', 'Test-2\\Test3\\filel.txt') >>> print('SEARCH: ', search ("Test', 'e')) [Test\\a.txt', 'Test\\File.txt', 'Test\\Testi\\File.txt', Test\\Testi\\Testi- A\\File.txt', 'Test\\Testi\\Test1-A\\Test1-A-A\ \A\\File.txt', 'Test\\Testi\\Test Test Test 1 Testi-c\ SEARCH
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
