GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
TREESCAN(1) User Contributed Perl Documentation TREESCAN(1)

treescan - scan directory trees, list dirs/files, stat, sync, grep

   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

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.

-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 to "stat" 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 ".".

 Marc Lehmann <schmorp@schmorp.de>
 http://home.schmorp.de/
2020-12-30 perl v5.32.1

Search for    or go to Top of page |  Section 1 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.