1READDIR(3am)               GNU Awk Extension Modules              READDIR(3am)
2
3
4

NAME

6       readdir - directory input parser for gawk
7

SYNOPSIS

9       @load "readdir"
10

DESCRIPTION

12       The readdir extension adds an input parser for directories.
13
14       When this extension is in use, instead of skipping directories named on
15       the command line (or with getline), they  are  read,  with  each  entry
16       returned as a record.
17
18       The record consists of three fields. The first two are the inode number
19       and the filename, separated by a forward slash character.   On  systems
20       where  the  directory  entry  contains  the file type, the record has a
21       third field which is a single letter indicating the type of the file: f
22       for  file,  d  for  directory,  b for a block device, c for a character
23       device, p for a FIFO, l for a symbolic link, s for a socket.
24
25       On systems without the file type information, the extension falls  back
26       to  calling  stat(2),  in  order  to provide the information.  Thus the
27       third field should never be u.
28

EXAMPLE

30       @load "readdir"
31       ...
32       BEGIN { FS = "/" }
33       { print "file name is", $2 }
34

SEE ALSO

36       GAWK:  Effective   AWK   Programming,   filefuncs(3am),   fnmatch(3am),
37       fork(3am),  inplace(3am),  ordchr(3am),  readfile(3am), revoutput(3am),
38       rwarray(3am), time(3am).
39
40       opendir(3), readdir(3), stat(2).
41

AUTHOR

43       Arnold Robbins, arnold@skeeve.com.
44

COPYING PERMISSIONS

46       Copyright © 2012, 2013, 2018, 2019 Free Software Foundation, Inc.
47
48       Permission is granted to make and distribute verbatim  copies  of  this
49       manual  page  provided  the copyright notice and this permission notice
50       are preserved on all copies.
51
52       Permission is granted to copy and distribute modified versions of  this
53       manual  page  under  the conditions for verbatim copying, provided that
54       the entire resulting derived work is distributed under the terms  of  a
55       permission notice identical to this one.
56
57       Permission  is granted to copy and distribute translations of this man‐
58       ual page into another language, under the above conditions for modified
59       versions,  except that this permission notice may be stated in a trans‐
60       lation approved by the Foundation.
61
62
63
64Free Software Foundation          Mar 17 2019                     READDIR(3am)
Impressum