Skip to content
shellmap

List files recursively

Print every file under a directory tree, optionally as a flat list of full paths.

How to list files recursively in each shell

Bashunix
find . -type f
Zshunix
find . -type f

Zsh-native alternative: `print -l **/*(.)` — the `.` glob qualifier restricts to plain files.

Fishunix
find . -type f
PowerShellwindows
Get-ChildItem -Recurse -File

Add `-Force` to include hidden / system files. Output paths are relative to PWD unless you `Resolve-Path`.

cmd.exewindows
dir /s /b /a-d

`/s` recurses, `/b` is bare format (full path only), `/a-d` excludes directories.

Equivalents listed for Bash, Zsh, Fish, PowerShell, cmd.exe.

Gotchas & notes

  • `find` walks symlinks **only** when given `-L`; otherwise symlink targets are not traversed. `ls -R` follows them blindly — beware of cycles.
  • PowerShell `Get-ChildItem -Recurse` follows reparse points / junctions; pass `-FollowSymlink:$false` (PS 7+) to mimic Unix default.
  • On Windows, `dir /s /b` outputs CRLF line endings — pipe through `more` or redirect to a file before consuming in another tool.
  • For very large trees, `find ... -print0 | xargs -0` is safer than splitting on whitespace; PowerShell streams natively as objects.

Related commands

Related tasks