


YDIR(1)                   User Commands                   YDIR(1)


NAME
       ydir  -  list  files,  search  filename wildcards, sort on
       time, size


SYNOPSIS (see also short description)
       ydir [-s] [-ntz] [-r] [-w 'wildcard'] [filename|dirname]

       Modifiers:
              ydir [-Fbcimq]
              ydir [-r] [-v]

       Help and version:
              ydir [-h][-d]
              ydir [-v]

       Debugging and seeing how arglist is expanded:
              ydir [-de468]

SHORT DESCRIPTION
       Sorting and searching for files:
       ydir -[n|r|t|z]s [ <filename>|<dirname> ... ]
        -n : no sort
        -r : reversed sort
        -t : sort on timestamp
        -z : sort on size
        -s : recurse into subdirs
        -w 'wildcard' : search files which match wildcard (remem
       ber quotes)
       Modifiers: -Fbcim
        -F : Add '/' for directories
        -b : brief listing, only filenames
        -c : print cksum crc in col.1 (hexadecimal format)
        -i : print i-node number
        -m : print only minutes in timefield
        -q : quiet, no totals
       Internals: -h | -v | -de468
        -v : print version
        -468d : different debug printouts, -dh help on exitcode
        -e : print numbered list of command line arguments
        -h : Show help screen (you are looking at it)


DESCRIPTION
       ydir  lists  files  in  directories,  current directory by
       default, sort on name,  time  or  size.  Further,  it  can
       search  for  files  matching  a wildcard specification. No
       other unix tool is as efficient  for  finding  the  newest
       file(s) in a file hierarchy.

       ydir  was  modelled to have the same functionality as DRI-
       DOS' xdir.  It has several output formats and  can  calcu
       late  CRC checksum in the same manner as the POSIX compli
       ant cksum program.



Linux/dax                  Dec 18, 1999                         1





YDIR(1)                   User Commands                   YDIR(1)


       ydir normally outputs some file  mode  information,  size,
       date and name.  The size is beautified for readability and
       the date is sortable, as opposed to ls long format (ls -l)
       which does not show times for old files.

       It handles Year 2000 as year 100.


OUTPUT FORMAT
  An example output line from ydir:
   ---   19,405,840  99-12-08   4:19:10    /share/lib/liby.a
  1 files; 19,405,840 bytes; 18,952 kb diskspace used (searched 0 directories)

       The  filemode  information  is limited as to show filetype
       and access for the current user. In case you are  root  it
       will still show the formal access mode. Root can write any
       file (of course) even if root does not have "write access"
       (analogous to read-only files on systems like CDos).

        --- is a normal file, read access.
        -w- is write access
        --! is not even read access
        --x is the execute attribute.
        --u is setuid
        --g is setuid
        --s is sticky bit

   SPECIAL FILES
        b-- is a block device.
        c-- is a character device.
        d-- is a dir
        lwx is a symlink
        p-- is a named pipe
        s-- is a socket

       The  file size number has commas between thousand in order
       to improve readability.

       The date format is sortable.

       Filenames are printed as the search  path  plus  filename,
       like  find  does.  There are some extra spaces in front of
       the filename column in order to make the  list  easier  to
       read.





MAIN OPTIONS
       Options  may  actually  be  positioned last on the command
       line.  This is true for GNU ls version 3.16 too, so I have
       decided  not  to do anything about it. As an example: ydir
       -s somedir -t will search somedir and sort on time.



Linux/dax                  Dec 18, 1999                         2





YDIR(1)                   User Commands                   YDIR(1)


       -n     Do not sort files. This way ydir  can  be  used  to
              generate  a  file  which  may be sorted afterwards.
              Note that ydir date and time is in a sortable  for
              mat. With the -n option there is no limit as to how
              many files ydir will list. When sorting there is an
              internal  limit  of  96000  files  (you  can easily
              increase that number in the  source.  It  is  shown
              with the -hd options).


       -s     Recursively  descend  any directory in the argument
              list. However, ydir will never accept .  or  ..  as
              arguments!


       -t     Sort on time.

       -z     Sort on size.

       -w wildcard
              search  for  files matching wildcards, beginning in
              current dir or at all specified dirs. This is handy
              with crc and size sort, but could be improved.

MODIFIER OPTIONS
       The modifier options affect output format.

       -F     Add  a slash after directory names. Especially use
              ful with brief format.

       -b     Brief format prints  only  filename  with  path  as
              specified on the command line.

       -c     Print  CRC  checksum  in  front  of every line. The
              totals of all checksums is printed after  the  sum
              mary line.

       -i     Print i-node number in front of attribute column.

       -m     Print  only  minutes,  not seconds. Save 3 columns.
              The date/time printout is always modification time.
              (Subject to change).

       -q     Quiet. Do not print totals.

       -v     Print version number and exit.

       -h     Print usage summary.

       -d     Debugging  information if ydir fails. Also for get
              ting internal information together  with  the  '-h'
              option.





Linux/dax                  Dec 18, 1999                         3





YDIR(1)                   User Commands                   YDIR(1)


MOSTLY FOR HACKERS
       -8     Print crc numbers in decimal as well as hexadecimal
              format, a hack for being able to verify  that  ydir
              arrives to the same numbers as does cksum.

       -6     Show a hexdump of the file stat(2) buffer.

       -4     Show filenames as the directories are read.

       -e     Show  what  arguments ydir receives from the shell.
              Alternatively, use -x if you need to  improve  your
              understanding  of  how  the  shell manipulates your
              command line before executing programs.



FILES
       /usr/local/bin/ydir         executable

EXAMPLES
       ydir -s /usr/include
              Will list all files in the  /usr/include  filetree,
              regardless  of  physical  device - boundaries (like
              find w/o -xdev).

       ydir -snw 'y*.c' /share/source/
              will   search   the   entire   tree   starting   at
              /share/source for all files matching 'y*.c'. Remem
              ber the quotes. Sometimes it will make all the dif
              ference because it is the shell which expands wild
              cards.

       ydir -sczw 'header.h' /usr
              will search the entire /usr tree  for  files  named
              'header.h'  sort  on size and print them with a crc
              number in front, so that you can see  whether  they
              are identical.


LIMITATIONS
       ydir  cannot  handle  more than 96000 files at the moment.
       You may change MAXENT in the source. However, on most sys
       tems 90000 has been enough.

       ydir accepts only ONE wildcard option; file searches which
       cannot be expressed with one wildcard must be done in  two
       tempi.

       ydir has no idea of access time or creation time - TODO!

       ydir  will  not follow symbolic links except when given on
       the command line.

       ydir cannot detect a circular hardlinked  directories  and



Linux/dax                  Dec 18, 1999                         4





YDIR(1)                   User Commands                   YDIR(1)


       may start an endless loop.


BUGS
       ydir  shows  same file size as ls -s, meaning that you can
       count on ydir to print the correct disk usage  for  sparse
       files.  However,  due  to  differences  in the handling of
       directories the totals  will  vary  when  you  list  whole
       directories.


       ydir  has not been tested exhaustively with odd pathnames.


       ydir is not capable of  handling  wide  character  set  or
       multibyte characters.



NOTES
       No other unix tool known to me can find the newest file in
       a file tree hieararchy. That is sometimes the only way  to
       see where some program creates or modifies files. Even for
       well documented scripts, like  boot  scripts,  ydir  is  a
       handy  help to find out what files have actually been cre
       ated or touched in a certain environment.

       You can do almost the same with find, but if you  have  to
       search  large  file trees for the newest file, you may run
       into situations where the shell complains about too long a
       command line, like the following example:

       ls -ltro $(find ./ ) | head

       Unix  ls -l output format would increase useability; on NT
       systems there will soon be so many  access  attributes  so
       that the reduced attribute format may welcome.


AUTHOR
       (c) 1999 Donald Axel, Saxenkolvej 20, DK3210 Vejby Denmark
       dax@superusers.dk GNU GPL - but  really,  any  first  year
       programmer  should  try  to make his own version!  The CRC
       algorithm  from  cksum.c   thanks   to   Q.   Frank   Xia,
       qx@math.columbia.edu.


SEE ALSO
       ls(1) find(1) stat(2) lstat(2) tar(1) pax(1)








Linux/dax                  Dec 18, 1999                         5


