Purge Empty Folders
Beginner Mode
Start your terminal to use beginner mode.
Scenario
The /tmp directory has accumulated numerous leftover folders from previous application runs and temporary scripts. Many of these directories are now empty and can be safely removed.
Task
Write a command or short script that searches through /tmp, finds all empty directories recursively, and deletes them without affecting any directories that contain files or subdirectories.
Example
# Before (empty directories present)
/tmp/old_build_cache/
/tmp/session_temp_1234/
/tmp/extract_workspace/
/tmp/app_tmp_5678/
/tmp/active_project/file.txt
# After (empty directories removed)
/tmp/active_project/file.txt
Terminal requires a larger screen
Open this page on a desktop or tablet (≥ 768px) to launch the terminal and practice hands-on.
Linux Terminal Environment
Write and execute your solution in the terminal below.
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →
CrowdStrike