The file-finder Reference Manual

This is the file-finder Reference Manual, version 0.2.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 06:06:25 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 file-finder

File finder. Enable rapid file search, inspection and manipulation.

Maintainer

vindarel

Author

Pierre Neidhardt <>

Home Page

https://github.com/lisp-maintainers/file-finder

License

GPL3+

Version

0.2.0

Dependencies
  • named-readtables (system).
  • alexandria (system).
  • serapeum (system).
  • local-time (system).
  • file-attributes (system).
  • str (system).
Source

file-finder.asd.

Child Components

2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 file-finder/file-finder.asd

Source

file-finder.asd.

Parent Component

file-finder (system).

ASDF Systems

file-finder.


2.1.2 file-finder/package.lisp

Source

file-finder.asd.

Parent Component

file-finder (system).

Packages

file-finder.


2.1.3 file-finder/file.lisp

Source

file-finder.asd.

Parent Component

file-finder (system).

Public Interface
Internals

2.1.4 file-finder/predicates.lisp

Source

file-finder.asd.

Parent Component

file-finder (system).

Public Interface
Internals

depth< (function).


3 Packages

Packages are listed by definition order.


3.1 file-finder

File object finder, one package for the two project files (file class, finder predicates).

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Special variables

Special Variable: *descend-hidden-directories*

When non-nil ‘finder’ descends into hidden directories as well.

Package

file-finder.

Source

file.lisp.

Special Variable: *exclude-directories*

Exclude these directories. Typically: node_modules.

Use pathnames with #p instead of simple strings.

Package

file-finder.

Source

file.lisp.

Special Variable: *file-constructor*

Function that takes a path and returns a ‘file’-like object.

Package

file-finder.

Source

file.lisp.

Special Variable: *include-directories*

When non-nil ‘finder’ includes directories in its search results.

Package

file-finder.

Source

file.lisp.

Special Variable: *include-hidden-files*

When non-nil ‘finder’ includes hidden files in the result.

Package

file-finder.

Source

file.lisp.

Special Variable: *print-abbreviate-home?*

Whether to abbreviate the user home directory to ’~’.

Package

file-finder.

Source

file.lisp.

Special Variable: *print-abbreviation-length*

Maximum abbreviation length, for each directory.

Package

file-finder.

Source

file.lisp.

Special Variable: *print-abbreviation-threshold*

Abbreviate printout if strictly longer than this value. Set to 0 to stop abbreviating.

Package

file-finder.

Source

file.lisp.

Special Variable: *print-date?*
Package

file-finder.

Source

file.lisp.

Special Variable: *print-reader-macro*
Package

file-finder.

Source

file.lisp.

Special Variable: *print-relative-path?*
Package

file-finder.

Source

file.lisp.

Special Variable: *print-size?*
Package

file-finder.

Source

file.lisp.


4.1.2 Macros

Macro: with-current-directory ((&optional file) &body body)

Call BODY while the POSIX current working directory is set to FILE.
This is just like ‘uiop:with-current-directory’ except that it takes a ‘file’ object.

Package

file-finder.

Source

file.lisp.


4.1.3 Ordinary functions

Function: current-directory ()
Package

file-finder.

Source

file.lisp.

Function: date< (timestamp)

Return a file predicate that matches on modification time less recent than TIMESTAMP.

Package

file-finder.

Source

predicates.lisp.

Function: date> (timestamp)

Return a file predicate that matches on modification time more recent than TIMESTAMP.

Package

file-finder.

Source

predicates.lisp.

Function: every-name~ (name &rest more-names)

Return a predicate that matches when all the names are contained in the file basename.

Package

file-finder.

Source

predicates.lisp.

Function: every-path~ (path-element &rest more-path-elements)

Return a predicate that matches when all the path elements are contained in the file path.

Example:

(file-finder:finder* :predicates (list (every-path~ "file" "lisp")))
;; => (F"file.lisp")

Package

file-finder.

Source

predicates.lisp.

Function: extension= (extension &rest more-extensions)

Return a predicate for files that match one of the provided extensions.

Package

file-finder.

Source

predicates.lisp.

Function: file (path)
Package

file-finder.

Source

file.lisp.

Function: file=? (file1 file2)

Return true if FILE1 and FILE2 point to the same file. They might not be the same objects.

Package

file-finder.

Source

file.lisp.

Function: finder (&rest predicate-specifiers)

List files in current directory that satisfy all PREDICATE-SPECIFIERS.
Directories are ignored.
Without PREDICATE-SPECIFIERS, list all files.

A predicate specifier can be:

- a string, in which case it is turned into (match-path STRING);
- a pathname, in which case it is turned into (match-path-end PATHNAME);
- a list of predicates, in which case it is turned into (apply #’alexandria:disjoin PREDICATES);
- a function (a predicate).

Passing a list of predicates connects them with a logical OR.

Ignore all directories specified in *exclude-directories* (node_modules).

Examples:

(finder "pred" "lisp") ; => list all files that have these two strings in their path name.
;; => "lisp" matches "quicklisp/local-projects/".

(finder "file" (extension= "lisp")) ; => list all files whose path contain "file" with a ".lisp" extension. ;; =>
(#F"~/quicklisp/local-projects/file-finder/predicates.lisp")

(finder (list "file" (extension= "lisp"))) ; => list all files matching one or the other predicate
; => many more results.

For a more tunable finder, see ‘finder*’.

Package

file-finder.

Source

file.lisp.

Function: finder* (&key root predicates recur-predicates)

List FILES (including directories) that satisfy all PREDICATES.
Without PREDICATES, list all files.

Recur in all subdirectories by default.
With RECUR-PREDICATES, recur only in subdirectories that satisfy the list of predicates.

Package

file-finder.

Source

file.lisp.

Function: hidden? (file)

Return T if this is a ’hidden’ file.

Unix only (hidden files start with "." (dot).

Package

file-finder.

Source

predicates.lisp.

Function: iname= (name &rest more-names)

Return a predicate that matches when one of the names matches, case insensitive, the file basename.

Package

file-finder.

Source

predicates.lisp.

Function: iname~ (name &rest more-names)

Return a predicate that matches when one of the names is contained in the file basename (case insensitive).

Package

file-finder.

Source

predicates.lisp.

Function: list-directory (&optional path sort)

Return entries in PATH.
By default, directories come first.
If SORT is non nil, sort them alphabetically.
Second value is the list of directories, third value is the non-directories.

Package

file-finder.

Source

file.lisp.

Function: name= (name &rest more-names)

Return a predicate that matches when one of the names matches, case sensitive, the file basename.

Package

file-finder.

Source

predicates.lisp.

Function: name~ (name &rest more-names)

Return a predicate that matches when one of the names is contained in the file basename (case sensitive).

Package

file-finder.

Source

predicates.lisp.

Function: path$ (path-suffix &rest more-path-suffixes)

Return a predicate that matches when one of the path suffixes matches the file path.

Package

file-finder.

Source

predicates.lisp.

Function: path~ (path-element &rest more-path-elements)

Return a predicate that matches when one of the path elements is contained in the file path.

Example:

(file-finder:finder* :predicates (list (path~ "file" "lisp")))
;; => (#F"mediafile.lisp" #F"file.lisp" #F"predicates.lisp")

Package

file-finder.

Source

predicates.lisp.

Function: separator (&optional char?)
Package

file-finder.

Source

file.lisp.


4.1.4 Generic functions

Generic Function: basename (file)
Package

file-finder.

Methods
Method: basename ((file file))

Return the file basename (including the extension). This returns the directory name for directories.

Source

file.lisp.

Generic Reader: creation-date (object)
Package

file-finder.

Methods
Reader Method: creation-date ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

creation-date.

Generic Function: directory? (file)
Package

file-finder.

Methods
Method: directory? ((file file))
Source

file.lisp.

Generic Reader: disk-usage (object)
Package

file-finder.

Methods
Reader Method: disk-usage ((file file))

Return FILE ‘disk-usage’.
If FILE is a directory and it’s disk-usage is 0 (never computed before), set it with ‘disk-usage*’ and return the new value.

Source

file.lisp.

Target Slot

disk-usage.

Generic Function: exists? (file)
Package

file-finder.

Methods
Method: exists? ((file file))
Source

file.lisp.

Generic Function: extension (file)
Package

file-finder.

Methods
Method: extension ((file file))

Return the file extension.
If none, return the empty string unlike ‘pathname-type’.

Source

file.lisp.

Generic Function: (setf extension) (file)
Package

file-finder.

Methods
Method: (setf extension) ((file file))

Set the FILE extension to NEW-EXTENSION. This renames the file.

Source

file.lisp.

Generic Function: file? (file)
Package

file-finder.

Methods
Method: file? ((file file))
Source

file.lisp.

Generic Reader: inode (object)
Package

file-finder.

Methods
Reader Method: inode ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

inode.

Generic Reader: kind (object)
Package

file-finder.

Methods
Reader Method: kind ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

kind.

Package

file-finder.

Methods

automatically generated reader method

Source

file.lisp.

Target Slot

link-count.

Generic Function: parent (file)
Package

file-finder.

Methods
Method: parent ((file file))

Return the parent directory of FILE.

Source

file.lisp.

Generic Function: path (object)
Package

file-finder.

Methods
Method: path ((p pathname))

Useful so that ‘path’ can be called both on a ‘file’ or a ‘pathname’. A trailing separator is automatically append for directories, if missing. This is to be consistent with the ‘path’ method for ‘file’.

Source

file.lisp.

Method: path ((s string))

Useful so that ‘path’ can be called both on a ‘file’ or a ‘string’.
A trailing separator is automatically append for directories, if missing. This is to be consistent with the ‘path’ method for ‘file’.

Source

file.lisp.

Reader Method: path ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

path.

Generic Function: (setf path) (file)
Package

file-finder.

Methods
Method: (setf path) ((file file))

Set FILE to a NEW-PATH. This renames the file.

Source

file.lisp.

Generic Function: relative-path (path &optional parent-directory)
Package

file-finder.

Methods
Method: relative-path ((file file) &optional parent-directory)

Return path of FILE relative to PARENT-DIRECTORY.
If PARENT-DIRECTORY is not a parent of FILE, return FILE’s path.

Source

file.lisp.

Method: relative-path ((path pathname) &optional parent-directory)

Return PATH relative to PARENT-DIRECTORY.
If PARENT-DIRECTORY is not a parent of PATH, return PATH.

Source

file.lisp.

Generic Reader: size (object)
Package

file-finder.

Methods
Reader Method: size ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

size.


4.1.5 Standalone methods

Method: initialize-instance :after ((file file) &key)
Source

file.lisp.

Method: print-object ((file file) stream)
Source

file.lisp.


4.1.6 Classes

Class: file
Package

file-finder.

Source

file.lisp.

Direct methods
Direct slots
Slot: path
Type

string

Initform

(error "path required")

Initargs

:path

Readers

path.

Writers

This slot is read-only.

Slot: inode
Initform

0

Readers

inode.

Writers

This slot is read-only.

Initform

0

Readers

link-count.

Writers

This slot is read-only.

Slot: kind
Type

file-finder:file-kind

Initform

:regular-file

Readers

kind.

Writers

This slot is read-only.

Slot: size
Initform

0

Readers

size.

Writers

This slot is read-only.

Slot: disk-usage
Initform

0

Readers

disk-usage.

Writers

This slot is read-only.

Slot: creation-date
Initform

(local-time:unix-to-timestamp 0)

Readers

creation-date.

Writers

This slot is read-only.

Slot: modification-date
Initform

(local-time:unix-to-timestamp 0)

Readers

modification-date.

Writers

This slot is read-only.

Slot: access-date
Initform

(local-time:unix-to-timestamp 0)

Readers

access-date.

Writers

This slot is read-only.


4.1.7 Types

Type: file-kind ()
Package

file-finder.

Source

file.lisp.


4.2 Internals


4.2.1 Special variables

Special Variable: *touch-command*
Package

file-finder.

Source

file.lisp.

Special Variable: +ls-time-format+
Package

file-finder.

Source

file.lisp.


4.2.2 Ordinary functions

Function: %specifier->predicate (specifier)
Package

file-finder.

Source

file.lisp.

Function: depth (file parent)

Return NIL if FILE is not a child of PARENT.

Package

file-finder.

Source

file.lisp.

Function: depth< (level &optional root)

Return a predicate that matches when the argument file is in a subdirectory of ROOT less deep than LEVEL.

Package

file-finder.

Source

predicates.lisp.

Function: ensure-match-path-predicates (predicates)

If a string is given inside PREDICATES, return a ‘match-path’ predicate.

This allows an easier use of finder*.

Package

file-finder.

Source

file.lisp.

Function: every-match-path (path-element &rest more-path-elements)

Return a predicate that matches when all path elements are contained in the file path.

Useful for ‘finder’ or ‘finder*’, but giving strings one after the other should be sufficient.

Package

file-finder.

Source

file.lisp.

Function: file-reader (stream char1 char2)
Package

file-finder.

Source

file.lisp.

Function: match-depth< (level &optional root)

Return a predicate that matches when the argument file is in a subdirectory of ROOT less deep than LEVEL.

Package

file-finder.

Source

file.lisp.

Function: match-path (path-element &rest more-path-elements)

Return a predicate that matches when one of the path elements is contained in the file path.

This is the one used when we give a string for predicate.

Useful for ‘finder’.

Package

file-finder.

Source

file.lisp.

Function: match-path-end (path-suffix &rest more-path-suffixes)

Return a predicate that matches when one of the path suffixes matches the file path.
Useful for ‘finder’.

Package

file-finder.

Source

file.lisp.

Function: parent? (file parent)

Return true if PARENT is a parent of FILE.

Package

file-finder.

Source

file.lisp.

Function: print-file (file stream &key reader-macro relative-path? abbreviation-length abbreviation-threshold abbreviate-home? size? date?)
Package

file-finder.

Source

file.lisp.

Function: read-/etc/group ()
Package

file-finder.

Source

file.lisp.

Function: shorten-home (path)
Package

file-finder.

Source

file.lisp.

Function: shorten-path (path &key abbreviation-length abbreviation-threshold abbreviate-home? ellipsis)

When ABBREVIATE-HOME?, abbreviate user home directory regardless of ABBREVIATION-THRESHOLD.

Package

file-finder.

Source

file.lisp.


4.2.3 Generic functions

Generic Reader: access-date (object)
Package

file-finder.

Methods
Reader Method: access-date ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

access-date.

Generic Function: (setf access-date) (file)
Package

file-finder.

Methods
Method: (setf access-date) ((file file))
Source

file.lisp.

Generic Function: disk-usage* (file)
Package

file-finder.

Methods
Method: disk-usage* ((file file))

Compute recursive ‘disk-usage’ of FILE if a directory. Return the new disk-usage.

Source

file.lisp.

Generic Reader: modification-date (object)
Package

file-finder.

Methods
Reader Method: modification-date ((file file))

automatically generated reader method

Source

file.lisp.

Target Slot

modification-date.

Generic Function: (setf modification-date) (file)
Package

file-finder.

Methods
Method: (setf modification-date) ((file file))

Set both the ‘modification-date’ and the ‘access-date’ of FILE.

Source

file.lisp.

Generic Function: uiop-path (file)
Package

file-finder.

Methods
Method: uiop-path ((p pathname))
Source

file.lisp.

Method: uiop-path ((s string))
Source

file.lisp.

Method: uiop-path ((file file))
Source

file.lisp.


4.2.4 Types

Type: function-specifier ()
Package

file-finder.

Source

file.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   %   (  
A   B   C   D   E   F   G   H   I   K   L   M   N   P   R   S   U   W  
Index Entry  Section

%
%specifier->predicate: Private ordinary functions

(
(setf access-date): Private generic functions
(setf access-date): Private generic functions
(setf extension): Public generic functions
(setf extension): Public generic functions
(setf modification-date): Private generic functions
(setf modification-date): Private generic functions
(setf path): Public generic functions
(setf path): Public generic functions

A
access-date: Private generic functions
access-date: Private generic functions

B
basename: Public generic functions
basename: Public generic functions

C
creation-date: Public generic functions
creation-date: Public generic functions
current-directory: Public ordinary functions

D
date<: Public ordinary functions
date>: Public ordinary functions
depth: Private ordinary functions
depth<: Private ordinary functions
directory?: Public generic functions
directory?: Public generic functions
disk-usage: Public generic functions
disk-usage: Public generic functions
disk-usage*: Private generic functions
disk-usage*: Private generic functions

E
ensure-match-path-predicates: Private ordinary functions
every-match-path: Private ordinary functions
every-name~: Public ordinary functions
every-path~: Public ordinary functions
exists?: Public generic functions
exists?: Public generic functions
extension: Public generic functions
extension: Public generic functions
extension=: Public ordinary functions

F
file: Public ordinary functions
file-reader: Private ordinary functions
file=?: Public ordinary functions
file?: Public generic functions
file?: Public generic functions
finder: Public ordinary functions
finder*: Public ordinary functions
Function, %specifier->predicate: Private ordinary functions
Function, current-directory: Public ordinary functions
Function, date<: Public ordinary functions
Function, date>: Public ordinary functions
Function, depth: Private ordinary functions
Function, depth<: Private ordinary functions
Function, ensure-match-path-predicates: Private ordinary functions
Function, every-match-path: Private ordinary functions
Function, every-name~: Public ordinary functions
Function, every-path~: Public ordinary functions
Function, extension=: Public ordinary functions
Function, file: Public ordinary functions
Function, file-reader: Private ordinary functions
Function, file=?: Public ordinary functions
Function, finder: Public ordinary functions
Function, finder*: Public ordinary functions
Function, hidden?: Public ordinary functions
Function, iname=: Public ordinary functions
Function, iname~: Public ordinary functions
Function, list-directory: Public ordinary functions
Function, match-depth<: Private ordinary functions
Function, match-path: Private ordinary functions
Function, match-path-end: Private ordinary functions
Function, name=: Public ordinary functions
Function, name~: Public ordinary functions
Function, parent?: Private ordinary functions
Function, path$: Public ordinary functions
Function, path~: Public ordinary functions
Function, print-file: Private ordinary functions
Function, read-/etc/group: Private ordinary functions
Function, separator: Public ordinary functions
Function, shorten-home: Private ordinary functions
Function, shorten-path: Private ordinary functions

G
Generic Function, (setf access-date): Private generic functions
Generic Function, (setf extension): Public generic functions
Generic Function, (setf modification-date): Private generic functions
Generic Function, (setf path): Public generic functions
Generic Function, access-date: Private generic functions
Generic Function, basename: Public generic functions
Generic Function, creation-date: Public generic functions
Generic Function, directory?: Public generic functions
Generic Function, disk-usage: Public generic functions
Generic Function, disk-usage*: Private generic functions
Generic Function, exists?: Public generic functions
Generic Function, extension: Public generic functions
Generic Function, file?: Public generic functions
Generic Function, inode: Public generic functions
Generic Function, kind: Public generic functions
Generic Function, link-count: Public generic functions
Generic Function, modification-date: Private generic functions
Generic Function, parent: Public generic functions
Generic Function, path: Public generic functions
Generic Function, relative-path: Public generic functions
Generic Function, size: Public generic functions
Generic Function, uiop-path: Private generic functions

H
hidden?: Public ordinary functions

I
iname=: Public ordinary functions
iname~: Public ordinary functions
initialize-instance: Public standalone methods
inode: Public generic functions
inode: Public generic functions

K
kind: Public generic functions
kind: Public generic functions

L
link-count: Public generic functions
link-count: Public generic functions
list-directory: Public ordinary functions

M
Macro, with-current-directory: Public macros
match-depth<: Private ordinary functions
match-path: Private ordinary functions
match-path-end: Private ordinary functions
Method, (setf access-date): Private generic functions
Method, (setf extension): Public generic functions
Method, (setf modification-date): Private generic functions
Method, (setf path): Public generic functions
Method, access-date: Private generic functions
Method, basename: Public generic functions
Method, creation-date: Public generic functions
Method, directory?: Public generic functions
Method, disk-usage: Public generic functions
Method, disk-usage*: Private generic functions
Method, exists?: Public generic functions
Method, extension: Public generic functions
Method, file?: Public generic functions
Method, initialize-instance: Public standalone methods
Method, inode: Public generic functions
Method, kind: Public generic functions
Method, link-count: Public generic functions
Method, modification-date: Private generic functions
Method, parent: Public generic functions
Method, path: Public generic functions
Method, path: Public generic functions
Method, path: Public generic functions
Method, print-object: Public standalone methods
Method, relative-path: Public generic functions
Method, relative-path: Public generic functions
Method, size: Public generic functions
Method, uiop-path: Private generic functions
Method, uiop-path: Private generic functions
Method, uiop-path: Private generic functions
modification-date: Private generic functions
modification-date: Private generic functions

N
name=: Public ordinary functions
name~: Public ordinary functions

P
parent: Public generic functions
parent: Public generic functions
parent?: Private ordinary functions
path: Public generic functions
path: Public generic functions
path: Public generic functions
path: Public generic functions
path$: Public ordinary functions
path~: Public ordinary functions
print-file: Private ordinary functions
print-object: Public standalone methods

R
read-/etc/group: Private ordinary functions
relative-path: Public generic functions
relative-path: Public generic functions
relative-path: Public generic functions

S
separator: Public ordinary functions
shorten-home: Private ordinary functions
shorten-path: Private ordinary functions
size: Public generic functions
size: Public generic functions

U
uiop-path: Private generic functions
uiop-path: Private generic functions
uiop-path: Private generic functions
uiop-path: Private generic functions

W
with-current-directory: Public macros


A.3 Variables

Jump to:   *   +  
A   C   D   I   K   L   M   P   S  
Index Entry  Section

*
*descend-hidden-directories*: Public special variables
*exclude-directories*: Public special variables
*file-constructor*: Public special variables
*include-directories*: Public special variables
*include-hidden-files*: Public special variables
*print-abbreviate-home?*: Public special variables
*print-abbreviation-length*: Public special variables
*print-abbreviation-threshold*: Public special variables
*print-date?*: Public special variables
*print-reader-macro*: Public special variables
*print-relative-path?*: Public special variables
*print-size?*: Public special variables
*touch-command*: Private special variables

+
+ls-time-format+: Private special variables

A
access-date: Public classes

C
creation-date: Public classes

D
disk-usage: Public classes

I
inode: Public classes

K
kind: Public classes

L
link-count: Public classes

M
modification-date: Public classes

P
path: Public classes

S
size: Public classes
Slot, access-date: Public classes
Slot, creation-date: Public classes
Slot, disk-usage: Public classes
Slot, inode: Public classes
Slot, kind: Public classes
Slot, link-count: Public classes
Slot, modification-date: Public classes
Slot, path: Public classes
Slot, size: Public classes
Special Variable, *descend-hidden-directories*: Public special variables
Special Variable, *exclude-directories*: Public special variables
Special Variable, *file-constructor*: Public special variables
Special Variable, *include-directories*: Public special variables
Special Variable, *include-hidden-files*: Public special variables
Special Variable, *print-abbreviate-home?*: Public special variables
Special Variable, *print-abbreviation-length*: Public special variables
Special Variable, *print-abbreviation-threshold*: Public special variables
Special Variable, *print-date?*: Public special variables
Special Variable, *print-reader-macro*: Public special variables
Special Variable, *print-relative-path?*: Public special variables
Special Variable, *print-size?*: Public special variables
Special Variable, *touch-command*: Private special variables
Special Variable, +ls-time-format+: Private special variables