kutils » System utilities

These are tools for interacting with Unix systems, built on top of uiop.

General
rsync(source dest &key (delete nil) (verbose nil) (output nil) (error-output nil))

Synchronize a SOURCE directory to a DEST using rsync.

Parameters:

  • SOURCE(string): The local directory or remote destination to synchronize.
  • DEST(string): The local directory or remote destination to synchronize.
  • DELETE(keyword): One of :before, :during, :after, or nil. Specifies whether rsync should delete files that don't exist in DEST.
  • VERBOSE(bool): If T, add "--progress" and "-v" to the argument list. Otherwise, "-q"(quiet-mode) is used.
  • OUTPUT(stream): The output stream to use.
  • ERROR-OUTPUT(stream): The stream to output errors to.

Returns: `nil` on successful synchronization (rsync exit code 0), or `nil` if an error occurs, with error details printed to `*error-output*`.

Example:


  (rsync *doc-path* *ssh-host*)
  (rsync "my/docs/" "otherserver:/var/www")

Notes:

  • Requires rsync to be installed and in the system’s path.
  • Assumes SSH access to the remote host (e.g., key-based authentication).
  • Does not validate SOURCE or DEST --- ensure they exist or are accessible.
Path utilities
path-as-string(path)
Given path, which can be either a string or pathname, return it as a string.
path-as-pathname(path)
Given path, which can be either a string or pathname, return it as a pathname.
extension-matches(path ext)
Returns t if path has the extensions ext. It is intended to be used in building predicates.
any-extension-matches(path extensions)
A predicate that returns T if path has any of the extensions provided.
filter-extensions(extensions path-list)
Given a list of paths in path-list, remove with an extension contained in extensions.
select-extensions(extensions path-list)
Given a list of paths in path-list, return a list of all paths with extensions contained in extensions.