Liking cljdoc? Tell your friends :D

me.raynes.fs

File system utilities in Clojure

File system utilities in Clojure
raw docstring

*cwd*clj

Current working directory. This cannot be changed in the JVM. Changing this will only change the working directory for functions in this library.

Current working directory. This cannot be changed in the JVM.
Changing this will only change the working directory for functions
in this library.
sourceraw docstring

absoluteclj

(absolute path)

Return absolute file.

Return absolute file.
sourceraw docstring

absolute?clj

(absolute? path)

Return true if path is absolute.

Return true if `path` is absolute.
sourceraw docstring

base-nameclj

(base-name path)
(base-name path trim-ext)

Return the base name (final segment/file part) of a path.

If optional trim-ext is a string and the path ends with that string, it is trimmed.

If trim-ext is true, any extension is trimmed.

Return the base name (final segment/file part) of a `path`.

If optional `trim-ext` is a string and the `path` ends with that
string, it is trimmed.

If `trim-ext` is true, any extension is trimmed.
sourceraw docstring

chdirclj

(chdir path)

set!s the value of *cwd* to path. Only works inside of with-mutable-cwd

set!s the value of `*cwd*` to `path`. Only works inside of
[[with-mutable-cwd]]
sourceraw docstring

child-of?clj

(child-of? p c)

Takes two paths and checks to see if the first path is a parent of the second.

Takes two paths and checks to see if the first path is a parent
of the second.
sourceraw docstring

chmodclj

(chmod mode path)

Change file permissions. Returns path.

mode can be a permissions string in octal or symbolic format. Symbolic: any combination of r (readable) w (writable) and x (executable). It should be prefixed with + to set or - to unset. And optional prefix of u causes the permissions to be set for the owner only. Octal: a string of three octal digits representing user, group, and world permissions. The three bits of each digit signify read, write, and execute permissions (in order of significance). Note that group and world permissions must be equal.

Examples:

(chmod "+x" "/tmp/foo") ; Sets executable for everyone
(chmod "u-wx" "/tmp/foo") ; Unsets owner write and executable
Change file permissions. Returns path.

`mode` can be a permissions string in octal or symbolic format.
Symbolic: any combination of `r` (readable) `w` (writable) and
`x` (executable). It should be prefixed with `+` to set or `-` to
unset. And optional prefix of `u` causes the permissions to be set
for the owner only.
Octal: a string of three octal digits representing user, group, and
world permissions. The three bits of each digit signify read, write,
and execute permissions (in order of significance). Note that group
and world permissions must be equal.

Examples:

```
(chmod "+x" "/tmp/foo") ; Sets executable for everyone
(chmod "u-wx" "/tmp/foo") ; Unsets owner write and executable
```
sourceraw docstring

copyclj

(copy from to)

Copy a file from from to to. Return to.

Copy a file from `from` to `to`. Return `to`.
sourceraw docstring

copy+clj

(copy+ src dest)

Copy src to dest, create directories if needed.

Copy `src` to `dest`, create directories if needed.
sourceraw docstring

copy-dirclj

(copy-dir from to)

Copy a directory from from to to. If to already exists, copy the directory to a directory with the same name as from within the to directory.

Copy a directory from `from` to `to`. If `to` already exists, copy the directory
to a directory with the same name as `from` within the `to` directory.
sourceraw docstring

copy-dir-intoclj

(copy-dir-into from to)

Copy directory into another directory if destination already exists.

Copy directory into another directory if destination already exists.
sourceraw docstring

createclj

(create f)

Create a new file.

Create a new file.
sourceraw docstring

deleteclj

(delete path)

Delete path.

Delete `path`.
sourceraw docstring

delete-dirclj

(delete-dir root & link-options)

Delete a directory tree. Optional link-options may be provided to determine whether or not to follow symbolic links.

Delete a directory tree. Optional
[link-options](http://docs.oracle.com/javase/7/docs/api/java/nio/file/LinkOption.html)
may be provided to determine whether or not to follow symbolic
links.
sourceraw docstring

directory?clj

(directory? path & link-options)

Return true if path is a directory, false otherwise. Optional link-options may be provided to determine whether or not to follow symbolic links.

Return true if `path` is a directory, false otherwise.
Optional
[link-options](http://docs.oracle.com/javase/7/docs/api/java/nio/file/LinkOption.html)
may be provided to determine whether or not to follow symbolic
links.
sourceraw docstring

ephemeral-dirclj

(ephemeral-dir prefix)
(ephemeral-dir prefix suffix)
(ephemeral-dir prefix suffix tries)

Create an ephemeral directory (will be deleted on JVM exit). Returns nil if dir could not be created even after n tries (default 10).

Create an ephemeral directory (will be deleted on JVM exit).
 Returns nil if dir could not be created even after n tries
(default 10).
sourceraw docstring

ephemeral-fileclj

(ephemeral-file prefix)
(ephemeral-file prefix suffix)
(ephemeral-file prefix suffix tries)

Create an ephemeral file (will be deleted on JVM exit). Returns nil if file could not be created even after n tries (default 10).

Create an ephemeral file (will be deleted on JVM exit).
 Returns nil if file could not be created even after n tries
(default 10).
sourceraw docstring

execclj

(exec & body)

Execute a shell command in the current directory

Execute a shell command in the current directory
sourceraw docstring

executable?clj

(executable? path)

Return true if path is executable.

Return true if `path` is executable.
sourceraw docstring

exists?clj

(exists? path)

Return true if path exists.

Return true if `path` exists.
sourceraw docstring

expand-homeclj

(expand-home path)

If path begins with a tilde (~), expand the tilde to the value of the user.home system property. If the path begins with a tilde immediately followed by some characters, they are assumed to be a username. This is expanded to the path to that user's home directory. This is (naively) assumed to be a directory with the same name as the user relative to the parent of the current value of user.home.

If `path` begins with a tilde (`~`), expand the tilde to the value
of the `user.home` system property. If the `path` begins with a
tilde immediately followed by some characters, they are assumed to
be a username. This is expanded to the path to that user's home
directory. This is (naively) assumed to be a directory with the same
name as the user relative to the parent of the current value of
`user.home`.
sourceraw docstring

extensionclj

(extension path)

Return the extension part of a file.

Return the extension part of a file.
sourceraw docstring

fileclj

(file path & paths)

If path is a period, replaces it with cwd and creates a new File object out of it and paths. Or, if the resulting File object does not constitute an absolute path, makes it absolutely by creating a new File object out of the paths and cwd.

If `path` is a period, replaces it with cwd and creates a new File object
out of it and `paths`. Or, if the resulting File object does not constitute
an absolute path, makes it absolutely by creating a new File object out of
the `paths` and cwd.
sourceraw docstring

file?clj

(file? path)

Return true if path is a file.

Return true if `path` is a file.
sourceraw docstring

find-filesclj

(find-files path pattern)

Find files matching given pattern.

Find files matching given `pattern`.
sourceraw docstring

find-files*clj

(find-files* path pred)

Find files in path by pred.

Find files in `path` by `pred`.
sourceraw docstring

globclj

(glob pattern)
(glob root pattern)

Returns files matching glob pattern.

Returns files matching glob pattern.
sourceraw docstring

hidden?clj

(hidden? path)

Return true if path is hidden.

Return true if `path` is hidden.
sourceraw docstring

homeclj

(home)
(home user)

With no arguments, returns the current value of the user.home system property. If a user is passed, returns that user's home directory. It is naively assumed to be a directory with the same name as the user located relative to the parent of the current value of user.home.

With no arguments, returns the current value of the `user.home` system
property. If a `user` is passed, returns that user's home directory. It
is naively assumed to be a directory with the same name as the `user`
located relative to the parent of the current value of `user.home`.
sourceraw docstring

iterate-dirclj

(iterate-dir path)

Return a sequence [root dirs files], starting from path in depth-first order

Return a sequence `[root dirs files]`, starting from `path` in depth-first order
sourceraw docstring

(link new-file existing-file)

Create a "hard" link from path to target. Requires Java version 7 or greater. The arguments are in the opposite order from the link(2) system call.

Create a "hard" link from path to target.
Requires Java version 7 or greater.  The arguments
are in the opposite order from the link(2) system
call.
sourceraw docstring

link?clj

(link? path)

Return true if path is a link. Requires Java version 7 or greater.

Return true if `path` is a link.
Requires Java version 7 or greater.
sourceraw docstring

list-dirclj

(list-dir path)

List files and directories under path.

List files and directories under `path`.
sourceraw docstring

mkdirclj

(mkdir path)

Create a directory.

Create a directory.
sourceraw docstring

mkdirsclj

(mkdirs path)

Make directory tree.

Make directory tree.
sourceraw docstring

mod-timeclj

(mod-time path)

Return file modification time.

Return file modification time.
sourceraw docstring

moveclj

(move source target & copy-options)

Move or rename a file to a target file. Requires Java version 7 or greater. Optional copy-options may be provided.

Move or rename a file to a target file. Requires Java version 7 or greater. Optional
[copy-options](http://docs.oracle.com/javase/7/docs/api/java/nio/file/CopyOption.html)
may be provided.
sourceraw docstring

nameclj

(name path)

Return the name part of a file.

Return the name part of a file.
sourceraw docstring

normalizedclj

(normalized path)

Return normalized (canonical) file.

Return normalized (canonical) file.
sourceraw docstring

ns-pathclj

(ns-path n)

Takes a namespace symbol and creates a path to it. Replaces hyphens with underscores. Assumes the path should be relative to cwd.

Takes a namespace symbol and creates a path to it. Replaces hyphens with
underscores. Assumes the path should be relative to cwd.
sourceraw docstring

parentclj

(parent path)

Return the parent path.

Return the parent path.
sourceraw docstring

parentsclj

(parents f)

Get all the parent directories of a path.

Get all the parent directories of a path.
sourceraw docstring

path-nsclj

(path-ns path)

Takes a path to a Clojure file and constructs a namespace symbol out of the path.

Takes a `path` to a Clojure file and constructs a namespace symbol
out of the path.
sourceraw docstring

(read-sym-link path)

Return the target of a 'soft' link. Requires Java version 7 or greater.

Return the target of a 'soft' link.
Requires Java version 7 or greater.
sourceraw docstring

readable?clj

(readable? path)

Return true if path is readable.

Return true if `path` is readable.
sourceraw docstring

renameclj

(rename old-path new-path)

Rename old-path to new-path. Only works on files.

Rename `old-path` to `new-path`. Only works on files.
sourceraw docstring

sizeclj

(size path)

Return size (in bytes) of file.

Return size (in bytes) of file.
sourceraw docstring

splitclj

(split path)

Split path to components.

Split `path` to components.
sourceraw docstring

split-extclj

(split-ext path)

Returns a vector of [name extension].

Returns a vector of `[name extension]`.
sourceraw docstring

(sym-link path target)

Create a "soft" link from path to target. Requires Java version 7 or greater.

Create a "soft" link from `path` to `target`.
Requires Java version 7 or greater.
sourceraw docstring

temp-dirclj

(temp-dir prefix)
(temp-dir prefix suffix)
(temp-dir prefix suffix tries)

Create a temporary directory. Returns nil if dir could not be created even after n tries (default 10).

Create a temporary directory. Returns nil if dir could not be created
even after n tries (default 10).
sourceraw docstring

temp-fileclj

(temp-file prefix)
(temp-file prefix suffix)
(temp-file prefix suffix tries)

Create a temporary file. Returns nil if file could not be created even after n tries (default 10).

Create a temporary file. Returns nil if file could not be created
even after n tries (default 10).
sourceraw docstring

temp-nameclj

(temp-name prefix)
(temp-name prefix suffix)

Create a temporary file name like what is created for temp-file and temp-dir.

Create a temporary file name like what is created for [[temp-file]]
and [[temp-dir]].
sourceraw docstring

tmpdirclj

(tmpdir)

The temporary file directory looked up via the java.io.tmpdir system property. Does not create a temporary directory.

The temporary file directory looked up via the `java.io.tmpdir`
system property. Does not create a temporary directory.
sourceraw docstring

touchclj

(touch path & [time])

Set file modification time (default to now). Returns path.

Set file modification time (default to now). Returns `path`.
sourceraw docstring

unix-rootclj

The root of a unix system is /, nil on Windows

The root of a unix system is `/`, `nil` on Windows
sourceraw docstring

walkclj

(walk func path)

Lazily walk depth-first over the directory structure starting at path calling func with three arguments [root dirs files]. Returns a sequence of the results.

Lazily walk depth-first over the directory structure starting at
`path` calling `func` with three arguments `[root dirs files]`.
Returns a sequence of the results.
sourceraw docstring

with-cwdclj/smacro

(with-cwd cwd & body)

Execute body with a changed working directory.

Execute `body` with a changed working directory.
sourceraw docstring

with-mutable-cwdclj/smacro

(with-mutable-cwd & body)

Execute the body in a binding with *cwd* bound to *cwd*. This allows you to change *cwd* with set!.

Execute the `body` in a binding with `*cwd*` bound to `*cwd*`.
This allows you to change `*cwd*` with `set!`.
sourceraw docstring

writeable?clj

(writeable? path)

Return true if path is writeable.

Return true if `path` is writeable.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close