Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a function that can find all files in a directory in a recursive manner. The function must be able to parse a regex pattern to find specific files. The function has to support any directory with any number of nested directories
- // Directory:
- // Documents
- // Files
- // schoolnotes.txt
- // Pictures
- // holiday_2020_1.png
- // holiday_2020_2.png
- // holiday_2021_1.png
- // Holiday Denmark
- // holiday_denmark_2019.jpg
- // holiday_denmark_copenhagen_2019.jpg
- // notes_from_holiday.txt
- // Examples:
- // findFiles('Documents', '.jpg')
- // should return:
- // Documents/Holiday Denmark/holiday_denmark_2019.jpg
- // Documents/Holiday Denmark/holiday_denmark_copenhagen_2019.jpg
- //
- // findFiles('Documents', '.txt')
- // should return:
- // Documents/Files/schoolnotes.txt
- // Documents/Holiday Denmark/notes_from_holiday.txt
- //
- // findFiles('Documents', 'notes')
- // should return:
- // Documents/Files/schoolnotes.txt
- // Documents/Holiday Denmark/notes_from_holiday.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement