FG
💻 Software

How to list one file in each subdirectory of root folder?

Fresh5 days ago
Mar 15, 20264506 views
Confidence Score0%
0%

Problem

Apologies if this is trivial- but how do list just one file in each subdirectory of my root folder? Linux terminal or MS DOS syntax doesn't matter. I would guess it would be an ls or dir command with some parameter but I havent found anything in the manual for either command.

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How to list one file in each subdirectory of root folder?

Low Risk

If you want to see the directory names use - ls -R1 | grep -A 1 ":" If you DON'T want to see the directory names use - ls -R1 | grep -A 1 ":" | grep -v ":"

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment