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.
raw docstring

absoluteclj

(absolute path)

Return absolute file.

Return absolute file.
raw docstring

absolute?clj

(absolute? path)

Return true if path is absolute.

Return true if `path` is absolute.
raw 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.
raw 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]]
raw 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.
raw 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
```
raw docstring

copyclj

(copy from to)

Copy a file from from to to. Return to.

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

copy+clj

(copy+ src dest)

Copy src to dest, create directories if needed.

Copy `src` to `dest`, create directories if needed.
raw 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.
raw 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.
raw docstring

createclj

(create f)

Create a new file.

Create a new file.
raw docstring

deleteclj

(delete path)

Delete path.

Delete `path`.
raw 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.
raw 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.
raw 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).
raw 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).
raw docstring

execclj

(exec & body)

Execute a shell command in the current directory

Execute a shell command in the current directory
raw docstring

executable?clj

(executable? path)

Return true if path is executable.

Return true if `path` is executable.
raw docstring

exists?clj

(exists? path)

Return true if path exists.

Return true if `path` exists.
raw 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`.
raw docstring

extensionclj

(extension path)

Return the extension part of a file.

Return the extension part of a file.
raw 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.
raw docstring

file?clj

(file? path)

Return true if path is a file.

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

find-filesclj

(find-files path pattern)

Find files matching given pattern.

Find files matching given `pattern`.
raw docstring

find-files*clj

(find-files* path pred)

Find files in path by pred.

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

globclj

(glob pattern)
(glob root pattern)

Returns files matching glob pattern.

Returns files matching glob pattern.
raw docstring

hidden?clj

(hidden? path)

Return true if path is hidden.

Return true if `path` is hidden.
raw 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`.
raw 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
raw docstring

(link new-file existing-file)

Create a "hard" link from path to target. The arguments are in the opposite order from the link(2) system call.

Create a "hard" link from path to target. The arguments
are in the opposite order from the link(2) system call.
raw docstring

link?clj

(link? path)

Return true if path is a link.

Return true if `path` is a link.
raw docstring

list-dirclj

(list-dir path)

List files and directories under path.

List files and directories under `path`.
raw docstring

mkdirclj

(mkdir path)

Create a directory.

Create a directory.
raw docstring

mkdirsclj

(mkdirs path)

Make directory tree.

Make directory tree.
raw docstring

mod-timeclj

(mod-time path)

Return file modification time.

Return file modification time.
raw docstring

moveclj

(move source target & copy-options)

Move or rename a file to a target file. Optional copy-options may be provided.

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

nameclj

(name path)

Return the name part of a file.

Return the name part of a file.
raw docstring

normalizedclj

(normalized path)

Return normalized (canonical) file.

Return normalized (canonical) file.
raw 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.
raw docstring

parentclj

(parent path)

Return the parent path.

Return the parent path.
raw docstring

parentsclj

(parents f)

Get all the parent directories of a path.

Get all the parent directories of a path.
raw 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.
raw docstring

(read-sym-link path)

Return the target of a 'soft' link.

Return the target of a 'soft' link.
raw docstring

readable?clj

(readable? path)

Return true if path is readable.

Return true if `path` is readable.
raw 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.
raw docstring

sizeclj

(size path)

Return size (in bytes) of file.

Return size (in bytes) of file.
raw docstring

splitclj

(split path)

Split path to components.

Split `path` to components.
raw docstring

split-extclj

(split-ext path)

Returns a vector of [name extension].

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

(sym-link path target)

Create a "soft" link from path to target.

Create a "soft" link from `path` to `target`.
raw 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).
raw 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).
raw 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]].
raw 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.
raw docstring

touchclj

(touch path & [time])

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

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

unix-rootclj

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

The root of a unix system is `/`, `nil` on Windows
raw 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.
raw docstring

with-cwdcljmacro

(with-cwd cwd & body)

Execute body with a changed working directory.

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

with-mutable-cwdcljmacro

(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!`.
raw docstring

writeable?clj

(writeable? path)

Return true if path is writeable.

Return true if `path` is writeable.
raw docstring

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

× close