PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Dropbox

Return all files under a path

Last updated: Mar 29, 2026

Quick Overview

This question evaluates filesystem traversal and recursive/iterative algorithm skills, including handling different path types, edge cases such as missing or inaccessible paths, and robustness concerns like symlink cycles when enumerating files.

  • medium
  • Dropbox
  • Coding & Algorithms
  • Software Engineer

Return all files under a path

Company: Dropbox

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are building a simple file crawler. ## Task Implement an API/function: - **Input:** a filesystem path `rootPath` - **Output:** a list/array of **all file paths** contained under `rootPath` (recursively), in any order. Assume: - Paths can be directories or files. - You are given a helper function similar to: - `listChildren(path) -> (subdirs, files)` where `subdirs` are immediate child directories and `files` are immediate child files. ## Notes / edge cases to clarify in your solution - If `rootPath` is a file, return just `[rootPath]`. - Decide what to do if the path does not exist or is not accessible (e.g., throw an error vs return empty). - Avoid infinite loops if the filesystem can contain symlinks (state your assumption if you ignore symlinks).

Quick Answer: This question evaluates filesystem traversal and recursive/iterative algorithm skills, including handling different path types, edge cases such as missing or inaccessible paths, and robustness concerns like symlink cycles when enumerating files.

Related Interview Questions

  • Compute worst-case guesses for adaptive hangman - Dropbox (medium)
  • Build a hit/miss word guessing game - Dropbox (medium)
  • Implement feedback for word guessing game - Dropbox (medium)
  • Implement hierarchical folder access check - Dropbox (medium)
  • Review checkout code for defects and privacy - Dropbox (Medium)
Dropbox logo
Dropbox
Jan 22, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
5
0
Loading...

You are building a simple file crawler.

Task

Implement an API/function:

  • Input: a filesystem path rootPath
  • Output: a list/array of all file paths contained under rootPath (recursively), in any order.

Assume:

  • Paths can be directories or files.
  • You are given a helper function similar to:
    • listChildren(path) -> (subdirs, files) where subdirs are immediate child directories and files are immediate child files.

Notes / edge cases to clarify in your solution

  • If rootPath is a file, return just [rootPath] .
  • Decide what to do if the path does not exist or is not accessible (e.g., throw an error vs return empty).
  • Avoid infinite loops if the filesystem can contain symlinks (state your assumption if you ignore symlinks).

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Dropbox•More Software Engineer•Dropbox Software Engineer•Dropbox Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.