Question: Write a recursive function search () that takes as a parameter the name of a file and the pathname of a folder and searches for

Write a recursive function search() that takes as a parameter the name of a file and the pathname of a folder and searches for the file in the folder and any subfolder contained within it, directly or indirectly. The function should return the pathname of the file, if found, or None (the type in Python, not the string 'None') if the file cannot be found in anywhere in the folder or any of its subfolders. Capitalization of the file name should not matter when finding the file. The following illustrates several searches using the test folders and directories that are provided in the zip file with the assignment template: MUST USE RECURSION AND NO LOOPS

This is the output and in python please.

Write a recursive function search() that takes as a parameter the name

Python 3.6.4 Shell File Edit She Debug Options Window Help >>> 3 -search' gertrude.jpg', 'testdirs') 'testdirsW folder 1W Folder 1W FOLDER2W gertrude. jpg' >>> 3 -search PROG. PY', "testdirs') testdirs\\folder1Folder11 PROG. PY >> search('File.txt', 'testdirs') 'testdirsfileA.txt' >>> 3 -search' amber.txt', 'testdirs') >>> type (s) >> 3 search'testfile2.py,testpath') 'testpath\directorydirectoryB21testfile2.py' >>> 3 -search' gertrude.jpg', 'testpath') >>> type (s) Ln: 25 Col: 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!