TREESCAN(1p)
π TREESCAN π
okay bestie, listen β this one is a Perl user-contributed situation, and it's genuinely iconic. treescan scans directory trees, lists dirs and files, stats, syncs and greps. it's giving "one tool, five jobs, zero complaints" β¨
π¦ NAME π¦
treescan β scan directory trees, list dirs/files, stat, sync, grep. that's the whole flex. no cap. πΈ
π SYNOPSIS π
treescan [OPTION...] [PATH...]
-q, --quiet do not print list of files/directories
-0, --print0 use null character instead of newline to separate names
-s, --stat call stat on every entry, to get stat data into cache
-d, --dirs only list dirs
-f, --files only list files
-p, --progress regularly print progress to stderr
--sync open/fsync/close every entry
-g, --grep=RE only list files that match the given perl RegEx
like, look at that. one command, all the vibes. OPTION... then PATH..., done. π
β¨ DESCRIPTION β¨
the treescan command scans directories and their contents, recursively. like, all the way down, no skipping. π«Ά
by default it lists all files and directories β and bestie, note that directories get a trailing / so you can tell them apart at a glance. but that's just the default behavior, because it can optionally do a bunch of other things too. main character versatility. π
oh and super important: if you don't give it any paths, it just uses "." β the current directory. so treescan with zero args is literally just "show me everything right here." π
π OPTIONS π
-q,--quietβ by default,treescanprints the full paths of every directory or file it finds. this option turns filename printing completely off. why would you want that? because sometimes you're only here for the side effects, bestie β like pullingstatdata into memory. no output, all vibes. π-0,--print0β instead of newlines, it slaps a null character after each filename. this is the move when you're piping the result into other programs, because it dodges all the quoting drama (for example, GNUgrep,xargsand so on all have options to deal with this). filenames with spaces and weird characters? not a problem, we don't know her. π-s,--statβ normallytreescanuses heuristics to avoid moststatcalls, which is literally what makes it so fast. this option forces it tostatevery single file. π₯
this is only useful for the side effect of pulling the stat data into the cache. if your disk cache is big enough, it'll be filled with file meta data once treescan is done, which can speed up subsequent commands considerably. and often you can run treescan in parallel with other directory-scanning programs to speed them up. it's a supportive bestie, we love to see it. π«Ά
-d,--dirsβ only lists directories, not file paths. perfect when you just want a quick list of directories and their subdirectories. directories only, files can stay home. β¨-f,--filesβ only lists files, not directories. this is the one when you want to operate on all the files in a hierarchy and the directories would only get in the way. respectfully, dirs, not today. π-p,--progressβ regularly prints some progress info to standard error. this is so useful for long running tasks, because you actually get to see something happening instead of staring at a blank terminal wondering if it's alive. and since it goes to standard error, you can still pipe the output oftreescaninto other programs like nothing happened. genius behavior tbh. πΈ--syncβ this option makes sure all the files/dirs in a tree are sync'ed to disk. for example, this could be useful after unpacking an archive, so you're sure the files actually hit the disk before you delete the archive file itself. don't delete the source before the copy is safe, bestie, that's the whole lesson. π-g,--grep=REβ applies a perl regular expression (see theperlremanpage) to all paths that would normally be printed, and only prints the matching paths. it's grep but make it treescan. π
the regular expression uses an /s (single line) modifier by default, so newlines are matched by ".". iykyk. π
π AUTHOR π
Marc Lehmann <schmorp@schmorp.de>
okay that's the whole page, bestie. go scan something. π¦
this was perl v5.42.3, brought to you on 2026-08-20 β from the TREESCAN(1p) era of the perl documentation, and yes, it ate. periodt. πβ¨
π¦ where this page comes from
- ubuntu stonking: libio-aio-perl 4.81-1build4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms