(absolute? path)Returns true if path is absolute via Path#isAbsolute.
Returns `true` if `path` is absolute via [Path#isAbsolute](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#isAbsolute()).
(absolutize path)Converts path into an absolute path via Path#toAbsolutePath.
Converts `path` into an absolute path via [Path#toAbsolutePath](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#toAbsolutePath()).
(canonicalize path)(canonicalize path {:keys [:nofollow-links]})Returns the canonical path for path via File#getCanonicalPath.
Options:
:nofollow-links - when set, falls back on absolutize + normalize.This function can be used as an alternative to real-path which requires files to exist.
Returns the canonical path for `path` via [File#getCanonicalPath](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#getCanonicalPath()). Options: * [`:nofollow-links`](/README.md#nofollow-links) - when set, falls back on [[absolutize]] + [[normalize]]. This function can be used as an alternative to [[real-path]] which requires files to exist.
(components path)Returns a seq of paths for all components of path.
i.e.: split on the file-separator.
Returns a seq of paths for all components of `path`. i.e.: split on the [[file-separator]].
(copy source-file target-path)(copy source-file
target-path
{:keys [replace-existing copy-attributes nofollow-links]})Copies source-file to target-path dir or file via Files/copy.
Options:
:replace-existing:copy-attributes:nofollow-links - used to determine to copy symbolic link itself or not.Returns target-path.
Copies `source-file` to `target-path` dir or file via [Files/copy](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#copy(java.nio.file.Path,java.nio.file.Path,java.nio.file.CopyOption...)). Options: * `:replace-existing` * `:copy-attributes` * [`:nofollow-links`](/README.md#nofollow-links) - used to determine to copy symbolic link itself or not. Returns `target-path`.
(copy-tree source-dir target-dir)(copy-tree source-dir
target-dir
{:keys [:replace-existing :copy-attributes :nofollow-links]
:as opts})Copies entire file tree from source-dir to target-dir. Creates target-dir if needed.
Options:
copy:posix-file-permissions - string format unix-like system permissions passed to create-dirs when creating target-dir.Copies entire file tree from `source-dir` to `target-dir`. Creates `target-dir` if needed. Options: * same as [[copy]] * `:posix-file-permissions` - string format unix-like system permissions passed to [[create-dirs]] when creating `target-dir`.
(create-dir dir)(create-dir dir {:keys [:posix-file-permissions]})Creates dir via Files/createDirectory.
Does not create parents.
Returns dir.
Options:
:posix-file-permissions - string format for unix-like system permissions for dir, as described in str->posix.
Affected by umask.Creates `dir` via [Files/createDirectory](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createDirectory(java.nio.file.Path,java.nio.file.attribute.FileAttribute...)). Does not create parents. Returns `dir`. Options: * `:posix-file-permissions` - string format for unix-like system permissions for `dir`, as described in [[str->posix]]. Affected by [umask](/README.md#umask).
(create-dirs dir)(create-dirs dir {:keys [:posix-file-permissions]})Creates dir via Files/createDirectories.
Also creates parents if needed.
Does not throw an exception if the dirs exist already. Similar to mkdir -p shell command.
Returns dir.
Options:
:posix-file-permissions - string format for unix-like system permissions for dir, as described in str->posix.
Affected by umask.Creates `dir` via [Files/createDirectories](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createDirectories(java.nio.file.Path,java.nio.file.attribute.FileAttribute...)). Also creates parents if needed. Does not throw an exception if the dirs exist already. Similar to `mkdir -p` shell command. Returns `dir`. Options: * `:posix-file-permissions` - string format for unix-like system permissions for `dir`, as described in [[str->posix]]. Affected by [umask](/README.md#umask).
(create-file file)(create-file file {:keys [:posix-file-permissions]})Creates empty file via Files/createFile.
Returns file.
Options:
:posix-file-permissions - string format for unix-like system permissions for file, as described in str->posix.
Affected by umask.Creates empty `file` via [Files/createFile](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createFile(java.nio.file.Path,java.nio.file.attribute.FileAttribute...)). Returns `file`. Options: * `:posix-file-permissions` - string format for unix-like system permissions for `file`, as described in [[str->posix]]. Affected by [umask](/README.md#umask).
(create-link link existing-file)Creates a new hard link (directory entry) for an existing-file via Files/createLink.
Returns link.
Creates a new hard `link` (directory entry) for an `existing-file` via [Files/createLink](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createLink(java.nio.file.Path,java.nio.file.Path)). Returns `link`.
(create-sym-link link target-path)Creates a symbolic link to target-path via Files/createSymbolicLink.
Returns link.
As of this writing, JDKs do not recognize empty-string target-path "" as the cwd.
Consider instead using a target-path of "." to link to the cwd.
Creates a symbolic `link` to `target-path` via [Files/createSymbolicLink](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createSymbolicLink(java.nio.file.Path,java.nio.file.Path,java.nio.file.attribute.FileAttribute...)). Returns `link`. As of this writing, JDKs do not recognize empty-string `target-path` `""` as the cwd. Consider instead using a `target-path` of `"."` to link to the cwd.
(create-temp-dir)(create-temp-dir {:keys [:dir :prefix :posix-file-permissions] :as opts})Returns path to directory created via Files/createTempDirectory.
This function does not set up any automatic deletion of the directories it
creates. See with-temp-dir for that functionality.
Options:
:dir - directory in which to create the new directory. Defaults to default
system temp dir (e.g. /tmp); see temp-dir. Must already exist.:prefix - provided as a hint to the process that generates the name of the
new directory. In most cases, this will be the beginning of the new directory
name. Defaults to a random (v4) UUID.:posix-file-permissions - string format unix-like system permissions as described in str->posix for new directory.
If not specified, uses the file system default permissions for new directories.
Affected by umask.:path - [DEPRECATED] previous name for :dir, kept
for backwards compatibility. If both :path and :dir are given (don't do
that!), :dir is used.Examples:
(create-temp-dir)(create-temp-dir {:posix-file-permissions "rwx------"})(create-temp-dir {:dir (path (cwd) "_workdir") :prefix "process-1-"})Returns path to directory created via [Files/createTempDirectory](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createTempDirectory(java.nio.file.Path,java.lang.String,java.nio.file.attribute.FileAttribute...)).
This function does not set up any automatic deletion of the directories it
creates. See [[with-temp-dir]] for that functionality.
Options:
* `:dir` - directory in which to create the new directory. Defaults to default
system temp dir (e.g. `/tmp`); see [[temp-dir]]. Must already exist.
* `:prefix` - provided as a hint to the process that generates the name of the
new directory. In most cases, this will be the beginning of the new directory
name. Defaults to a random (v4) UUID.
* `:posix-file-permissions` - string format unix-like system permissions as described in [[str->posix]] for new directory.
If not specified, uses the file system default permissions for new directories.
Affected by [umask](/README.md#umask).
* :warning: `:path` - **[DEPRECATED]** previous name for `:dir`, kept
for backwards compatibility. If both `:path` and `:dir` are given (don't do
that!), `:dir` is used.
Examples:
* `(create-temp-dir)`
* `(create-temp-dir {:posix-file-permissions "rwx------"})`
* `(create-temp-dir {:dir (path (cwd) "_workdir") :prefix "process-1-"})`
(create-temp-file)(create-temp-file {:keys [:dir :prefix :suffix :posix-file-permissions]
:as opts})Returns path to empty file created via Files/createTempFile.
This function does not set up any automatic deletion of the files it
creates. Create the file in a with-temp-dir for that functionality.
Options:
:dir - directory in which to create the new file. Defaults to default
system temp dir (e.g. /tmp); see temp-dir. Must already exist.:prefix - provided as a hint to the process that generates the name of the
new file. In most cases, this will be the beginning of the new file name.
Defaults to a random (v4) UUID.:suffix - provided as a hint to the process that generates the name of the
new file. In most cases, this will be the end of the new file name.
Defaults to a random (v4) UUID.:posix-file-permissions - string format unix-like system permissions for new file, as described in str->posix.
If not specified, uses the file system default permissions for new files.
Affected by umask.:path - [DEPRECATED] Previous name for :dir, kept
for backwards compatibility. If both :path and :dir are given (don't do
that!), :dir is used.Examples:
(create-temp-file)(create-temp-file {:posix-file-permissions "rw-------"})(create-temp-file {:dir (path (cwd) "_workdir") :prefix "process-1-" :suffix "-queue"})Returns path to empty file created via [Files/createTempFile](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#createTempFile(java.nio.file.Path,java.lang.String,java.lang.String,java.nio.file.attribute.FileAttribute...)).
This function does not set up any automatic deletion of the files it
creates. Create the file in a [[with-temp-dir]] for that functionality.
Options:
* `:dir` - directory in which to create the new file. Defaults to default
system temp dir (e.g. `/tmp`); see [[temp-dir]]. Must already exist.
* `:prefix` - provided as a hint to the process that generates the name of the
new file. In most cases, this will be the beginning of the new file name.
Defaults to a random (v4) UUID.
* `:suffix` - provided as a hint to the process that generates the name of the
new file. In most cases, this will be the end of the new file name.
Defaults to a random (v4) UUID.
* `:posix-file-permissions` - string format unix-like system permissions for new file, as described in [[str->posix]].
If not specified, uses the file system default permissions for new files.
Affected by [umask](/README.md#umask).
* :warning: `:path` - **[DEPRECATED]** Previous name for `:dir`, kept
for backwards compatibility. If both `:path` and `:dir` are given (don't do
that!), `:dir` is used.
Examples:
* `(create-temp-file)`
* `(create-temp-file {:posix-file-permissions "rw-------"})`
* `(create-temp-file {:dir (path (cwd) "_workdir") :prefix "process-1-" :suffix "-queue"})`
(creation-time path)(creation-time path {:keys [nofollow-links] :as opts})Returns creation time of path as FileTime.
See README notes for some details on behaviour.
See also: set-creation-time, last-modified-time, file-time->instant, file-time->millis
Returns creation time of `path` as [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html). See [README notes](/README.md#creation-time) for some details on behaviour. See also: [[set-creation-time]], [[last-modified-time]], [[file-time->instant]], [[file-time->millis]]
(cwd)Returns current working directory path.
Returns current working directory path.
(delete path)Deletes path via Files/delete.
Returns nil if the delete was successful,
throws otherwise. Does not follow symlinks.
Deletes `path` via [Files/delete](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#delete(java.nio.file.Path)). Returns `nil` if the delete was successful, throws otherwise. Does not follow symlinks.
(delete-if-exists path)Deletes path if it exists via Files/deleteIfExists.
Returns true if the delete was successful,
false if path didn't exist. Does not follow symlinks.
Deletes `path` if it exists via [Files/deleteIfExists](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#deleteIfExists(java.nio.file.Path)). Returns `true` if the delete was successful, `false` if `path` didn't exist. Does not follow symlinks.
(delete-on-exit path)Requests delete of path on exit via File#deleteOnExit.
Returns path.
Requests delete of `path` on exit via [File#deleteOnExit](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#deleteOnExit()). Returns `path`.
(delete-tree root-path)(delete-tree root-path {:keys [force]})Deletes the file tree at root-path using walk-file-tree. Similar to rm -rf shell command. Does not follow symlinks.
Options:
:force - if true forces deletion of read-only files/directories. Similar to chmod -R +wx + rm -rf shell commands.Deletes the file tree at `root-path` using [[walk-file-tree]]. Similar to `rm -rf` shell command. Does not follow symlinks. Options: * `:force` - if `true` forces deletion of read-only files/directories. Similar to `chmod -R +wx` + `rm -rf` shell commands.
(directory? path)(directory? path {:keys [:nofollow-links]})Returns `true` if `path` is a directory via [Files/isDirectory](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isDirectory(java.nio.file.Path,java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(ends-with? this-path other-path)Returns true if this-path ends with other-path via Path#endsWith.
See also: starts-with?
Returns `true` if `this-path` ends with `other-path` via [Path#endsWith](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#endsWith(java.nio.file.Path)). See also: [[starts-with?]]
(exec-paths)Returns a vector of command search paths (from the PATH environment variable). Same
as (split-paths (System/getenv "PATH")).
Returns a vector of command search paths (from the `PATH` environment variable). Same as `(split-paths (System/getenv "PATH"))`.
(executable? path)Returns true if path is executable via Files/isExecutable.
Returns `true` if `path` is executable via [Files/isExecutable](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isExecutable(java.nio.file.Path)).
(exists? path)(exists? path {:keys [:nofollow-links]})Returns `true` if `path` exists via [Files/exists](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#exists(java.nio.file.Path,java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(expand-home path)Returns path replacing ~ (tilde) with home dir.
If path:
~, returns path.~ then file-separator, ~ is replaced with (home).
e.g., ~/foo -> /home/myuser/foo~ then some other chars, those other chars are
assumed to be a username, then naively expanded to (home username).
e.g., ~someuser/foo -> /home/someuser/fooSee also: home
Returns `path` replacing `~` (tilde) with home dir. If `path`: - does not start with `~`, returns `path`. - starts with `~` then [[file-separator]], `~` is replaced with `(home)`. e.g., `~/foo` -> `/home/myuser/foo` - starts with `~` then some other chars, those other chars are assumed to be a username, then naively expanded to `(home username)`. e.g., `~someuser/foo` -> `/home/someuser/foo` See also: [[home]]
(extension path)Returns the extension of path via split-ext.
Returns the extension of `path` via [[split-ext]].
(file path)(file path & paths)Coerces path(s) into a File, combining multiple paths into one.
Multiple-arg versions treat the first argument as parent and subsequent args
as children relative to the parent.
Coerces `path`(s) into a `File`, combining multiple paths into one. Multiple-arg versions treat the first argument as parent and subsequent args as children relative to the parent.
(file-name path)Returns the name of the file or directory for path via File#getName.
E.g. (file-name "foo/bar/baz") returns "baz".
Returns the name of the file or directory for `path` via [File#getName](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#getName()). E.g. `(file-name "foo/bar/baz")` returns `"baz"`.
The system-dependent default path component separator character (as string).
The system-dependent default path component separator character (as string).
(file-time->millis ft)Converts ft FileTime
to epoch milliseconds (long).
Converts `ft` [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html) to epoch milliseconds (long).
(get-attribute path attribute)(get-attribute path attribute {:keys [:nofollow-links]})Returns value of `attribute` for `path` via [Files/getAttribute](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#getAttribute(java.nio.file.Path,java.lang.String,java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(glob root-dir pattern)(glob root-dir pattern opts)Returns a vector of paths matching glob pattern (on path and filename) relative to root-dir.
Patterns containing ** or / will cause a recursive walk under
root-dir, unless overriden with :recursive false. Similarly, :hidden will be automatically enabled
when pattern starts with a dot.
Glob interpretation is done using the rules described in
FileSystem#getPathMatcher
Options:
:hidden - match hidden paths. Implied true when pattern starts with a dot;
otherwise, defaults to false. Note: on Windows files starting with a dot are
not hidden, unless their hidden attribute is set.:follow-links - follow symlinks. Defaults to false.:recursive - implied true when pattern contains ** or /; otherwise, defaults to false.
true - pattern is matched against all descendant files and directories under root-dirfalse - pattern is matched only against immediate children under root-dir:max-depth - max depth to descend into directory structure, when
recursing. Defaults to Integer/MAX_VALUE.Examples:
(fs/glob "." "**.clj") - finds .clj files and dirs under . dir and its subdirs(fs/glob "." "**.clj" {:recursive false}) - finds .clj files and dirs immediately under . dir only(fs/glob "." "*.clj" {:recursive true}) - finds .clj files and dirs immediately under . only (pattern lacks directory wildcards)If on macOS, see note on glob
See also: match
Returns a vector of paths matching glob `pattern` (on path and filename) relative to `root-dir`.
Patterns containing `**` or `/` will cause a recursive walk under
`root-dir`, unless overriden with `:recursive false`. Similarly, `:hidden` will be automatically enabled
when `pattern` starts with a dot.
Glob interpretation is done using the rules described in
[FileSystem#getPathMatcher](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
Options:
* `:hidden` - match hidden paths. Implied `true` when `pattern` starts with a dot;
otherwise, defaults to `false`. Note: on Windows files starting with a dot are
not hidden, unless their hidden attribute is set.
* [`:follow-links`](/README.md#follow-links) - follow symlinks. Defaults to `false`.
* `:recursive` - implied `true` when `pattern` contains `**` or `/`; otherwise, defaults to `false`.
* `true` - `pattern` is matched against all descendant files and directories under `root-dir`
* `false` - `pattern` is matched only against immediate children under `root-dir`
* `:max-depth` - max depth to descend into directory structure, when
recursing. Defaults to `Integer/MAX_VALUE`.
Examples:
- `(fs/glob "." "**.clj")` - finds `.clj` files and dirs under `.` dir and its subdirs
- `(fs/glob "." "**.clj" {:recursive false})` - finds `.clj` files and dirs immediately under `.` dir only
- `(fs/glob "." "*.clj" {:recursive true})` - finds `.clj` files and dirs immediately under `.` only (`pattern` lacks directory wildcards)
If on macOS, see [note on glob](/README.md#glob)
See also: [[match]](gunzip gz-file)(gunzip gz-file target-dir)(gunzip gz-file target-dir {:keys [replace-existing]})Extracts gz-file to target-dir.
If target-dir not specified (or nil) defaults to gz-file dir.
File is extracted to target-dir with gz-file file-name without .gz extension.
Creates target-dir dir(s) if necessary.
The gz-file is not deleted.
Options:
:replace-existing - when true overwrites existing fileSee also: gzip
Extracts `gz-file` to `target-dir`. If `target-dir` not specified (or `nil`) defaults to `gz-file` dir. File is extracted to `target-dir` with `gz-file` [[file-name]] without `.gz` extension. Creates `target-dir` dir(s) if necessary. The `gz-file` is not deleted. Options: * `:replace-existing` - when `true` overwrites existing file See also: [[gzip]]
(gzip source-file)(gzip source-file {:keys [dir out-file]})Gzips source-file to :dir/:out-file.
Does not store the source-file name in the .gz file.
The source-file is not deleted.
Options:
:dir(s) - created if necessary. If not specified, defaults to source-file dir.:out-file - if not specified, defaults to source-file file-name with .gz extension.Returns the created gzip file.
See also: gunzip
Gzips `source-file` to `:dir`/`:out-file`. Does not store the `source-file` name in the `.gz` file. The `source-file` is not deleted. Options: * `:dir`(s) - created if necessary. If not specified, defaults to `source-file` dir. * `:out-file` - if not specified, defaults to `source-file` [[file-name]] with `.gz` extension. Returns the created gzip file. See also: [[gunzip]]
(hidden? path)Returns true if path is hidden via Files/isHidden.
TIP: some older JDKs can throw on empty-string path (hidden "").
Consider instead checking cwd via (hidden ".").
Returns `true` if `path` is hidden via [Files/isHidden](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isHidden(java.nio.file.Path)). TIP: some older JDKs can throw on empty-string path `(hidden "")`. Consider instead checking cwd via `(hidden ".")`.
(home)(home user)Returns home dir path.
With no arguments, returns the current value of the user.home
system property. If a user is passed, returns that user's home
directory as found in the parent of home with no args.
Returns home dir path. With no arguments, returns the current value of the `user.home` system property. If a `user` is passed, returns that user's home directory as found in the parent of home with no args.
(last-modified-time path)(last-modified-time path {:keys [nofollow-links] :as opts})Returns last modified time of path as FileTime.
See also: set-last-modified-time, creation-time, file-time->instant, file-time->millis
Returns last modified time of `path` as [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html). See also: [[set-last-modified-time]], [[creation-time]], [[file-time->instant]], [[file-time->millis]]
(list-dir dir)(list-dir dir glob-or-accept)Returns a vector of all paths in dir. For descending into subdirectories use glob.
glob-or-accept - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthyReturns a vector of all paths in `dir`. For descending into subdirectories use [[glob]]. - `glob-or-accept` - a [[glob]] string such as `"*.edn"` or a `(fn accept [^java.nio.file.Path p]) -> truthy`
(list-dirs dirs glob-or-accept)Similar to list-dir but accepts multiple roots in dirs and returns the concatenated results.
glob-or-accept - a glob string such as "*.edn" or a (fn accept [^java.nio.file.Path p]) -> truthySimilar to [[list-dir]] but accepts multiple roots in `dirs` and returns the concatenated results. - `glob-or-accept` - a [[glob]] string such as `"*.edn"` or a `(fn accept [^java.nio.file.Path p]) -> truthy`
(match root-dir pattern)(match root-dir pattern {:keys [hidden follow-links max-depth recursive]})Returns a vector of paths matching pattern (on path and filename) relative to root-dir.
Pattern interpretation is done using the rules described in
FileSystem#getPathMatcher
Options:
:hidden - match hidden paths - note: on Windows paths starting with
a dot are not hidden, unless their hidden attribute is set. Defaults to
false, i.e. skip hidden files and folders.:follow-links - follow symlinks. Defaults to false.:recursive
true - pattern is matched against all descendant files and directories under root-dirfalse (default) - pattern is matched only against immediate children under root-dir:max-depth - max depth to descend into directory structure, when
matching recursively. Defaults to Integer/MAX_VALUE.Examples:
(fs/match "." "regex:.*\\.clj" {:recursive true})See also: glob
Returns a vector of paths matching `pattern` (on path and filename) relative to `root-dir`.
Pattern interpretation is done using the rules described in
[FileSystem#getPathMatcher](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
Options:
* `:hidden` - match hidden paths - note: on Windows paths starting with
a dot are not hidden, unless their hidden attribute is set. Defaults to
`false`, i.e. skip hidden files and folders.
* [`:follow-links`](/README.md#follow-links) - follow symlinks. Defaults to false.
* `:recursive`
* `true` - `pattern` is matched against all descendant files and directories under `root-dir`
* `false` (default) - `pattern` is matched only against immediate children under `root-dir`
* `:max-depth` - max depth to descend into directory structure, when
matching recursively. Defaults to `Integer/MAX_VALUE`.
Examples:
- `(fs/match "." "regex:.*\\.clj" {:recursive true})`
See also: [[glob]](millis->file-time millis)Converts epoch milliseconds (long) to a FileTime.
Converts epoch milliseconds (long) to a [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html).
(modified-since anchor-path path-set)Returns seq of regular files (non-directories, non-symlinks) from path-set that were modified since the anchor-path.
The anchor-path can be a regular file or directory, in which case
the recursive max last modified time stamp is used as the timestamp
to compare with. The path-set may be a regular file, directory or
collection of paths (e.g. as returned by glob). Directories are
searched recursively.
Returns seq of regular files (non-directories, non-symlinks) from `path-set` that were modified since the `anchor-path`. The `anchor-path` can be a regular file or directory, in which case the recursive max last modified time stamp is used as the timestamp to compare with. The `path-set` may be a regular file, directory or collection of paths (e.g. as returned by [[glob]]). Directories are searched recursively.
(move source-path target-path)(move source-path target-path {:keys [:replace-existing :atomic-move]})Moves or renames dir or file at source-path to target-path dir or file via Files/move.
If target-path is a directory, moves source-path under target-path.
Never follows symbolic links.
Returns target-path.
Options:
replace-existing - overwrite existing target-path, default falseatomic-move - watchers will only see complete target-path file, default falseMoves or renames dir or file at `source-path` to `target-path` dir or file via [Files/move](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#move(java.nio.file.Path,java.nio.file.Path,java.nio.file.CopyOption...)). If `target-path` is a directory, moves `source-path` under `target-path`. Never follows symbolic links. Returns `target-path`. Options: * `replace-existing` - overwrite existing `target-path`, default `false` * `atomic-move` - watchers will only see complete `target-path` file, default `false`
(normalize path)Returns normalized path for path via Path#normalize.
Returns normalized path for `path` via [Path#normalize](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#normalize()).
(owner path)(owner path {:keys [:nofollow-links]})Returns the owner of path via Files/getOwner.
Call str on return value to get the owner name as a string.
Options:
Returns the owner of `path` via [Files/getOwner](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#getOwner(java.nio.file.Path,java.nio.file.LinkOption...)). Call `str` on return value to get the owner name as a string. Options: * [`:nofollow-links`](/README.md#nofollow-links)
(parent path)Returns parent path of path via Path#getParent.
Akin to dirname in bash.
Returns parent path of `path` via [Path#getParent](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#getParent()). Akin to `dirname` in bash.
(path path)(path parent child)(path parent child & more)Coerces path(s) into a Path, combining multiple paths into one.
Multiple-arg versions treat the first argument as parent and subsequent
args as children relative to the parent.
Coerces `path`(s) into a `Path`, combining multiple paths into one. Multiple-arg versions treat the first argument as parent and subsequent args as children relative to the parent.
The system-dependent path-separator character (as string).
The system-dependent path-separator character (as string).
(posix->str p)Converts a set of PosixFilePermission p to a string, like "rwx------".
See also: str->posix
Converts a set of `PosixFilePermission` `p` to a string, like `"rwx------"`. See also: [[str->posix]]
(posix-file-permissions path)(posix-file-permissions path {:keys [:nofollow-links]})Returns a set of PosixFilePermission for path via Files/getPosixFilePermissions.
Use posix->str to convert to a string.
Options:
See also: set-posix-file-permissions
Returns a set of `PosixFilePermission` for `path` via [Files/getPosixFilePermissions](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#getPosixFilePermissions(java.nio.file.Path,java.nio.file.LinkOption...)). Use [[posix->str]] to convert to a string. Options: * [`:nofollow-links`](/README.md#nofollow-links) See also: [[set-posix-file-permissions]]
(read-all-bytes file)Returns contents of file as byte array via Files/readAllBytes.
Returns contents of `file` as byte array via [Files/readAllBytes](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#readAllBytes(java.nio.file.Path)).
(read-all-lines file)(read-all-lines file {:keys [charset] :or {charset "utf-8"}})Returns contents of file as a vector of lines via Files/readAllLines.
Options:
:charset - defaults to "utf-8"Returns contents of `file` as a vector of lines via [Files/readAllLines](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#readAllLines(java.nio.file.Path,java.nio.charset.Charset)). Options: * `:charset` - defaults to `"utf-8"`
(read-attributes path attributes)(read-attributes path attributes {:keys [:nofollow-links :key-fn] :as opts})Same as read-attributes* but returns requested attributes for path as a map with keywordized attribute keys.
Options:
:key-fn - optionally override keywordizing function with your own.:nofollow-linksSame as [[read-attributes*]] but returns requested `attributes` for `path` as a map with keywordized attribute keys. Options: * `:key-fn` - optionally override keywordizing function with your own. * [`:nofollow-links`](/README.md#nofollow-links)
(read-attributes* path attributes)(read-attributes* path attributes {:keys [:nofollow-links]})Returns requested `attributes` for `path` via [Files/readAttributes](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#readAttributes(java.nio.file.Path,java.lang.Class,java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(read-link sym-link-path)Returns the immediate target of sym-link-path via Files/readSymbolicLink.
The target need not exist.
Returns the immediate target of `sym-link-path` via [Files/readSymbolicLink](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#readSymbolicLink(java.nio.file.Path)). The target need not exist.
(readable? path)Returns true if path is readable via Files/isReadable
Returns `true` if `path` is readable via [Files/isReadable](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isReadable(java.nio.file.Path))
(real-path path)(real-path path {:keys [:nofollow-links]})Converts `path` into real path via [Path#toRealPath](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#toRealPath(java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(regular-file? path)(regular-file? path {:keys [:nofollow-links]})Returns `true` if `path` is a regular file via [Files/isRegularFile](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isRegularFile(java.nio.file.Path,java.nio.file.LinkOption...)). Options: * [`:nofollow-links`](/README.md#nofollow-links)
(relative? path)Returns true if path is relative (in other words, is not absolute?).
Returns `true` if `path` is relative (in other words, is not [[absolute?]]).
(relativize base-path other-path)Returns other-path relative to base-path via Path#relativize.
Examples:
(fs/relativize "a/b" "a/b/c/d") => c/d(fs/relativize "a/b/c/d" "a/b") => ../..Returns `other-path` relative to `base-path` via [Path#relativize](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#relativize(java.nio.file.Path)). Examples: - `(fs/relativize "a/b" "a/b/c/d")` => `c/d` - `(fs/relativize "a/b/c/d" "a/b")` => `../..`
(root path)Returns root path for path, or nil, via Path#getRoot.
The return value depends upon the runtime platform.
On Windows, returns Windows specific roots, ex: (replace forward slash with backslash):
C:/ for C:/foo/barC: for C:foo/bar//server/share for //server/share/foo/barOn Linux and macOS, returns the leading / for anything that looks like an absolute path.
Returns root path for `path`, or `nil`, via [Path#getRoot](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#getRoot()). The return value depends upon the runtime platform. On Windows, returns Windows specific roots, ex: (replace forward slash with backslash): * `C:/` for `C:/foo/bar` * `C:` for `C:foo/bar` * `//server/share` for `//server/share/foo/bar` On Linux and macOS, returns the leading `/` for anything that looks like an absolute path.
(same-file? this-path other-path)Returns true if this-path is the same file as other-path via Files/isSamefile.
Returns `true` if `this-path` is the same file as `other-path` via [Files/isSamefile](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isSameFile(java.nio.file.Path,java.nio.file.Path)).
(set-attribute path attribute value)(set-attribute path attribute value {:keys [:nofollow-links]})Sets attribute for path to value via Files/setAttribute.
Sets `attribute` for `path` to `value` via [Files/setAttribute](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#setAttribute(java.nio.file.Path,java.lang.String,java.lang.Object,java.nio.file.LinkOption...)).
(set-creation-time path time)(set-creation-time path time {:keys [nofollow-links] :as opts})Sets creation time of path.
time can be epoch milliseconds,
FileTime,
or Instant.
Options:
See README notes for some details on behaviour.
See also: creation-time
Sets creation `time` of `path`. `time` can be `epoch milliseconds`, [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html), or [Instant](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Instant.html). Options: * [`:nofollow-links`](/README.md#nofollow-links) See [README notes](/README.md#set-creation-time) for some details on behaviour. See also: [[creation-time]]
(set-last-modified-time path time)(set-last-modified-time path time {:keys [nofollow-links] :as opts})Sets last modified time of path.
time can be epoch milliseconds,
FileTime,
or Instant.
See also: last-modified-time
Sets last modified `time` of `path`. `time` can be `epoch milliseconds`, [FileTime](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/attribute/FileTime.html), or [Instant](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/time/Instant.html). See also: [[last-modified-time]]
(set-posix-file-permissions path posix-file-permissions)Sets posix-file-permissions on path via Files/setPosixFilePermissions.
Accepts a string like "rwx------" or a set of PosixFilePermission.
See also: posix-file-permissions
Sets `posix-file-permissions` on `path` via [Files/setPosixFilePermissions](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#setPosixFilePermissions(java.nio.file.Path,java.util.Set)). Accepts a string like `"rwx------"` or a set of `PosixFilePermission`. See also: [[posix-file-permissions]]
(size path)Returns the size of path in bytes.
Returns the size of `path` in bytes.
(split-ext path)(split-ext path {:keys [ext]})Splits path on extension. Returns [name ext].
Leading directories in path are not processed.
Options:
:ext - split on specified extension (do not include a leading dot)Examples:
(fs/split-ext "foo.bar.baz") => ["foo.bar" "baz"](fs/split-ext "foo.bar.baz" {:ext "bar.baz"}) => ["foo" "bar.baz"](fs/split-ext "foo.bar.baz" {:ext "png"}) => ["foo.bar.baz" nil]Splits `path` on extension. Returns `[name ext]`.
Leading directories in `path` are not processed.
Options:
* `:ext` - split on specified extension (do not include a leading dot)
Examples:
- `(fs/split-ext "foo.bar.baz")` => `["foo.bar" "baz"]`
- `(fs/split-ext "foo.bar.baz" {:ext "bar.baz"})` => `["foo" "bar.baz"]`
- `(fs/split-ext "foo.bar.baz" {:ext "png"})` => `["foo.bar.baz" nil]`(split-paths joined-paths)Splits joined-paths string into a vector of paths by OS-specific path-separator.
On UNIX systems, the separator is :, on Microsoft Windows systems it is ;.
Splits `joined-paths` string into a vector of paths by OS-specific [[path-separator]]. On UNIX systems, the separator is `:`, on Microsoft Windows systems it is `;`.
(starts-with? this-path other-path)Returns true if this-path starts with other-path via Path#startsWith.
See also: ends-with?
Returns `true` if `this-path` starts with `other-path` via [Path#startsWith](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Path.html#startsWith(java.nio.file.Path)). See also: [[ends-with?]]
(str->posix s)Converts a string s to a set of PosixFilePermission.
s is a string like "rwx------".
See also: posix->str
Converts a string `s` to a set of `PosixFilePermission`. `s` is a string like `"rwx------"`. See also: [[posix->str]]
(strip-ext path)(strip-ext path {:keys [ext] :as opts})Strips extension from path via split-ext.
Strips extension from `path` via [[split-ext]].
(sym-link? path)Returns true if path is a symbolic link via Files/isSymbolicLink.
Returns `true` if `path` is a symbolic link via [Files/isSymbolicLink](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isSymbolicLink(java.nio.file.Path)).
(temp-dir)Returns java.io.tmpdir property as path.
Returns `java.io.tmpdir` property as path.
(touch path)(touch path {:keys [time nofollow-links] :as opts})Updates last modified time of path to :time, creating path as a file if it does not exist.
If path is deleted by some other process/thread before :time is set,
a NoSuchFileException will be thrown. Callers can, if their use case requires it,
implement their own retry loop.
Options:
:time - last modified time (epoch milliseconds, Instant, or FileTime), defaults to current time:nofollow-linksUpdates last modified time of `path` to `:time`, creating `path` as a file if it does not exist. If `path` is deleted by some other process/thread before `:time` is set, a `NoSuchFileException` will be thrown. Callers can, if their use case requires it, implement their own retry loop. Options: * `:time` - last modified time (epoch milliseconds, `Instant`, or `FileTime`), defaults to current time * [`:nofollow-links`](/README.md#nofollow-links)
(unixify path)Returns path as string with Unix-style file separators (/).
Returns `path` as string with Unix-style file separators (`/`).
(unzip zip-file)(unzip zip-file target-dir)(unzip zip-file target-dir {:keys [replace-existing extract-fn]})Unzips zip-file to target-dir (default ".").
Options:
:replace-existing - true / false: overwrite existing files:extract-fn - function that decides if the current ZipEntry
should be extracted. Extraction only occurs if a truthy value is returned (i.e. not nil/false).
The function is only called for files (not directories) with a single map arg:
:entry - the current ZipEntry:name - the name of the ZipEntry (result of calling getName)See also: zip.
Unzips `zip-file` to `target-dir` (default `"."`). Options: * `:replace-existing` - `true` / `false`: overwrite existing files * `:extract-fn` - function that decides if the current `ZipEntry` should be extracted. Extraction only occurs if a truthy value is returned (i.e. not nil/false). The function is only called for files (not directories) with a single map arg: * `:entry` - the current `ZipEntry` * `:name` - the name of the `ZipEntry` (result of calling `getName`) See also: [[zip]].
(update-file file f & xs)(update-file file opts f & xs)Updates the contents of text file with result of applying function f with old contents and args xs.
Returns the new contents.
Options:
:charset - charset of file, default to "utf-8"Updates the contents of text `file` with result of applying function `f` with old contents and args `xs`. Returns the new contents. Options: * `:charset` - charset of file, default to "utf-8"
(walk-file-tree path
{:keys [:pre-visit-dir :post-visit-dir :visit-file
:visit-file-failed :follow-links :max-depth]})Walks path via Files/walkFileTree.
Options:
:follow-links:max-depth - maximum directory depth to walk, defaults is unlimited:pre-visit-dir - args [dir attrs]:post-visit-dir - args [dir ex]:visit-file - args [file attrs]:visit-file-failed - args [file ex]All visitor functions must return one of :continue, :skip-subtree, :skip-siblings or :terminate.
A different return value will throw. When not supplied, visitor functions default
to (constantly :continue).
Returns path.
Walks `path` via [Files/walkFileTree](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#walkFileTree(java.nio.file.Path,java.util.Set,int,java.nio.file.FileVisitor)). Options: * [`:follow-links`](/README.md#follow-links) * `:max-depth` - maximum directory depth to walk, defaults is unlimited * Override default visitor functions via: * `:pre-visit-dir` - args `[dir attrs]` * `:post-visit-dir` - args `[dir ex]` * `:visit-file` - args `[file attrs]` * `:visit-file-failed` - args `[file ex]` All visitor functions must return one of `:continue`, `:skip-subtree`, `:skip-siblings` or `:terminate`. A different return value will throw. When not supplied, visitor functions default to `(constantly :continue)`. Returns `path`.
(which program)(which program opts)Returns path to first executable program found in :paths, similar to the which Unix command.
When program is a relative or absolute path, :paths option is not consulted.
On Windows, the :win-exts variants are still searched.
On other OSes, the path for program will be returned if executable, else nil.
Options:
:paths - paths to search, default is return of (exec-paths):win-exts - active on Windows only. Searches for program with filename extensions specified in :win-exts option.
If program already includes an extension from :win-exts, it will be searched as-is first.
Default is ["com" "exe" "bat" "cmd"].Returns path to first executable `program` found in `:paths`, similar to the `which` Unix command. When `program` is a relative or absolute path, `:paths` option is not consulted. On Windows, the `:win-exts` variants are still searched. On other OSes, the path for `program` will be returned if executable, else `nil`. Options: * `:paths` - paths to search, default is return of ([[exec-paths]]) * `:win-exts` - active on Windows only. Searches for `program` with filename extensions specified in `:win-exts` option. If `program` already includes an extension from `:win-exts`, it will be searched as-is first. Default is `["com" "exe" "bat" "cmd"]`.
(which-all program)(which-all program opts)Returns a vector of every path to program found in (exec-paths). See which.
Returns a vector of every path to `program` found in ([[exec-paths]]). See [[which]].
(windows?)Returns true if OS is Windows.
Returns `true` if OS is Windows.
(with-temp-dir [temp-dir] & body)(with-temp-dir [temp-dir opts] & body)Evaluates body with temp-dir bound to the result of (create-temp-dir opts).
By default, the temp-dir will be removed with delete-tree on exit from the scope.
Options:
create-temp-dir for options that control directory creation:keep - if true does not delete the directory on exit from macro scope.Example:
(with-temp-dir [d]
(let [t (path d "extract")
(create-dir t)
(gunzip path-to-zip t)
(copy (path t "the-one-file-I-wanted.txt") (path permanent-dir "file-I-extracted.txt"))))
;; d no longer exists here
Evaluates body with `temp-dir` bound to the result of `(create-temp-dir opts)`.
By default, the `temp-dir` will be removed with [[delete-tree]] on exit from the scope.
Options:
* see [[create-temp-dir]] for options that control directory creation
* `:keep` - if `true` does not delete the directory on exit from macro scope.
Example:
```
(with-temp-dir [d]
(let [t (path d "extract")
(create-dir t)
(gunzip path-to-zip t)
(copy (path t "the-one-file-I-wanted.txt") (path permanent-dir "file-I-extracted.txt"))))
;; d no longer exists here
```
(writable? path)Returns true if path is writable via Files/isWritable
Returns `true` if `path` is writable via [Files/isWritable](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#isWritable(java.nio.file.Path))
(write-bytes file bytes)(write-bytes file
bytes
{:keys [append create truncate-existing write] :as opts})Writes bytes to file via Files/write.
Options:
:create - (default true):truncate-existing - (default true):write - (default true):append - (default false)java.nio.file.StandardOption.Examples:
(fs/write-bytes f (.getBytes (String. "foo"))) ;; overwrites + truncates or creates new file
(fs/write-bytes f (.getBytes (String. "foo")) {:append true})
Writes `bytes` to `file` via [Files/write](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#write(java.nio.file.Path,byte%5B%5D,java.nio.file.OpenOption...)).
Options:
* `:create` - (default `true`)
* `:truncate-existing` - (default `true`)
* `:write` - (default `true`)
* `:append` - (default `false`)
* or any `java.nio.file.StandardOption`.
Examples:
``` clojure
(fs/write-bytes f (.getBytes (String. "foo"))) ;; overwrites + truncates or creates new file
(fs/write-bytes f (.getBytes (String. "foo")) {:append true})
```(write-lines file lines)(write-lines file lines {:keys [charset] :or {charset "utf-8"} :as opts})Writes lines, a seqable of strings, to file via Files/write.
Options:
:charset - (default "utf-8")Open options:
:create - (default true):truncate-existing - (default true):write - (default true):append - (default false)java.nio.file.StandardOption.Writes `lines`, a seqable of strings, to `file` via [Files/write](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html#write(java.nio.file.Path,java.lang.Iterable,java.nio.charset.Charset,java.nio.file.OpenOption...)). Options: * `:charset` - (default `"utf-8"`) Open options: * `:create` - (default `true`) * `:truncate-existing` - (default `true`) * `:write` - (default `true`) * `:append` - (default `false`) * or any `java.nio.file.StandardOption`.
(xdg-cache-home)(xdg-cache-home app)Returns path to user-specific non-essential data as described in the XDG Base Directory Specification.
Uses env-var XDG_CACHE_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".cache").
When provided, appends app to the returned path.
Returns path to user-specific non-essential data as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). Uses env-var `XDG_CACHE_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".cache")`. When provided, appends `app` to the returned path.
(xdg-config-home)(xdg-config-home app)Returns path to user-specific configuration files as described in the XDG Base Directory Specification.
Uses env-var XDG_CONFIG_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".config").
When provided, appends app to the returned path.
Returns path to user-specific configuration files as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). Uses env-var `XDG_CONFIG_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".config")`. When provided, appends `app` to the returned path.
(xdg-data-home)(xdg-data-home app)Returns path to user-specific data files as described in the XDG Base Directory Specification.
Uses env-var XDG_DATA_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".local" "share").
When provided, appends app to the returned path.
Returns path to user-specific data files as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). Uses env-var `XDG_DATA_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".local" "share")`. When provided, appends `app` to the returned path.
(xdg-state-home)(xdg-state-home app)Returns path to user-specific state files as described in the XDG Base Directory Specification.
Uses env-var XDG_STATE_HOME (if set and representing an absolute path), else (fs/path (fs/home) ".local" "state").
When provided, appends app to the returned path.
Returns path to user-specific state files as described in the [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). Uses env-var `XDG_STATE_HOME` (if set and representing an absolute path), else `(fs/path (fs/home) ".local" "state")`. When provided, appends `app` to the returned path.
(zip zip-file path-or-paths)(zip zip-file path-or-paths opts)Zips path-or-paths into zip-file. A path may be a file or
directory. Directories are included recursively and their names are
preserved in the zip file. Currently only accepts relative paths.
Options:
:root - optional directory to be elided in zip-file entries. E.g.: (fs/zip ["src"] {:root "src"}):path-fn - an optional custom path conversion function.
A single-arg function called for each file system path returning the path to be used for the corresponding zip entry.See also: unzip.
Zips `path-or-paths` into `zip-file`. A path may be a file or
directory. Directories are included recursively and their names are
preserved in the zip file. Currently only accepts relative paths.
Options:
* `:root` - optional directory to be elided in `zip-file` entries. E.g.: `(fs/zip ["src"] {:root "src"})`
* `:path-fn` - an optional custom path conversion function.
A single-arg function called for each file system path returning the path to be used for the corresponding zip entry.
See also: [[unzip]].cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |