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.
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)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started