Advertisement
xXCalleManXx

PHP Test #2

Sep 24th, 2020 (edited)
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. // 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
  2.  
  3. // Directory:
  4. // Documents
  5. // Files
  6. // schoolnotes.txt
  7. // Pictures
  8. // holiday_2020_1.png
  9. // holiday_2020_2.png
  10. // holiday_2021_1.png
  11. // Holiday Denmark
  12. // holiday_denmark_2019.jpg
  13. // holiday_denmark_copenhagen_2019.jpg
  14. // notes_from_holiday.txt
  15.  
  16. // Examples:
  17. // findFiles('Documents', '.jpg')
  18. // should return:
  19. // Documents/Holiday Denmark/holiday_denmark_2019.jpg
  20. // Documents/Holiday Denmark/holiday_denmark_copenhagen_2019.jpg
  21. //
  22. // findFiles('Documents', '.txt')
  23. // should return:
  24. // Documents/Files/schoolnotes.txt
  25. // Documents/Holiday Denmark/notes_from_holiday.txt
  26. //
  27. // findFiles('Documents', 'notes')
  28. // should return:
  29. // Documents/Files/schoolnotes.txt
  30. // Documents/Holiday Denmark/notes_from_holiday.txt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement