treescan - Man Page
scan directory trees, list dirs/files, stat, sync, grep
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
Description
The treescan command scans directories and their contents recursively. By default it lists all files and directories (with trailing /
), but it can optionally do various other things.
If no paths are given, treescan will use .
, the current directory.
Options
- -q, --quiet
By default, treescan prints the full paths of all directories or files it finds. This option disables printing of filenames completely. This is useful if you want to run treescan solely for its side effects, such as pulling
stat
data into memory.- -0, --print0
Instead of using newlines, use null characters after each filename. This is useful to avoid quoting problems when piping the result into other programs (for example, GNU grep, xargs and so on all have options to deal with this).
- -s, --stat
Normally, treescan will use heuristics to avoid most
stat
calls, which is what makes it so fast. This option forces it tostat
every 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 will be filled with file meta data after treescan is done, which can speed up subsequent commands considerably. Often, you can run treescan in parallel with other directory-scanning programs to speed them up.- -d, --dirs
Only lists directories, not file paths. This is useful if you quickly want a list of directories and their subdirectories.
- -f, --files
Only list files, not directories. This is useful if you want to operate on all files in a hierarchy, and the directories would ony get in the way.
- -p, --progress
Regularly print some progress information to standard error. This is useful to get some progress information on long running tasks. Since the progress is printed to standard error, you can pipe the output of treescan into other programs as usual.
- --sync
The
--sync
option can be used to make sure all the files/dirs in a tree are sync'ed to disk. For example this could be useful after unpacking an archive, to make sure the files hit the disk before deleting the archive file itself.- -g, --grep=RE
This applies a perl regular expression (see the perlre manpage) to all paths that would normally be printed and will only print matching paths.
The regular expression uses an
/s
(single line) modifier by default, so newlines are matched by.
.
Author
Marc Lehmann <schmorp@schmorp.de> http://home.schmorp.de/