Tools to manipulate local files
Is a proxy to babashka.fs tools.
Tools to manipulate local files Is a proxy to babashka.fs tools.
(actual-copy copy-actions)
Do the actual copy of copy-actions
.
Do the actual copy of `copy-actions`.
(combine-files target-filename & filenames)
Read text content of files filenames
and combine them into target-filename
.
Read text content of files `filenames` and combine them into `target-filename`.
(copy-actions file-rich-list src-dir dst-dir options)
For all file-rich-list
, adds a relative-path
and a target-dir-path
.
For all `file-rich-list`, adds a `relative-path` and a `target-dir-path`.
(copy-dir src-path dst-path options)
(copy-file src-path dst-path options)
(create-sym-link path target)
Creates a sym link to target
linking to path
.
Creates a sym link to `target` linking to `path`.
(create-temp-dir & sub-dirs)
Returns a subdirectory path string of the system temporary directory.
sub-dirs
is an optional list of strings, each one is a sub directory.
Returns a subdirectory path string of the system temporary directory. `sub-dirs` is an optional list of strings, each one is a sub directory.
(create-temp-file & filename)
Create a temporary file with filename
name of the file (optional).
Create a temporary file with `filename` name of the file (optional).
(delete-dir dir)
Deletes dir
and returns it.
If dir
does not exist, returns nil
Deletes `dir` and returns it. If `dir` does not exist, returns nil
(delete-file filename)
Deletes filename
and returns it.
If filename
does not exist, returns nil.
Deletes `filename` and returns it. If `filename` does not exist, returns nil.
(delete-path path)
Deletes path
and returns it.
Returns nil if the path
does not exists.
Deletes `path` and returns it. Returns nil if the `path` does not exists.
(ensure-dir-exists path)
Creates directory dir
if not already existing.
Creates directory `dir` if not already existing.
(expand-home-str str)
In string str
, ~ is expanded to the actual value of home directory.
In string `str`, ~ is expanded to the actual value of home directory.
(file-rich-list paths)
Returns, for each element in the paths
, return a rich file description with :
with path
copied here,
:exists?
key check the existence of the file.
and one of:
:dir?
key is true,:file?
key is true.Returns, for each element in the `paths`, return a rich file description with : * with `path` copied here, * `:exists?` key check the existence of the file. * and one of: * for a directory, `:dir?` key is true, * for a file, `:file?` key is true.
(is-existing-dir? dirname)
Check if this the path exist and is a directory.
Check if this the path exist and is a directory.
(is-existing-file? filename)
Returns true if filename
path already exist and is not a directory.
Returns true if `filename` path already exist and is not a directory.
(is-existing-path? path)
Returns true if filename
path already exist.
Returns true if `filename` path already exist.
(make-executable filename)
Make file filename
executable.
Make file `filename` executable.
(matching-files dir file-pattern)
Match files recursively found in dir
that are matching file-pattern
.
Match files recursively found in `dir` that are matching `file-pattern`.
(modified-since anchor file-set)
Returns true
if anchor
is older than one of the file in file-set
.
Returns `true` if `anchor` is older than one of the file in `file-set`.
(pp-file filename file-content)
Pretty print the file.
Pretty print the file.
(read-file filename)
Read the file named filename
.
Returns:
filename
raw-content
if file can be read.invalid?
to true
whatever why.exception
if something wrong happened.Read the file named `filename`. Returns: * `filename` * `raw-content` if file can be read. * `invalid?` to `true` whatever why. * `exception` if something wrong happened.
(search-files root-dir pattern)
(search-files root-dir pattern options)
Search files and dirs.
root-dir
is where the root directory of the search-filespattern
is a regular expression or a glob as described in java docoptions
(Optional, default = {}) are boolean value for :hidden
, :recursive
and :follow-lins
. See babashka fs for details.
For instance:(files/search-files "" "**{.clj,.cljs,.cljc,.edn}")
search all clj file-paths in pwd directorySearch files and dirs. * `root-dir` is where the root directory of the search-files * `pattern` is a regular expression or a glob as described in [java doc](https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String)) * `options` (Optional, default = {}) are boolean value for `:hidden`, `:recursive` and `:follow-lins`. See [babashka fs](https://github.com/babashka/fs/blob/master/API.md#glob) for details. For instance: * `(files/search-files "" "**{.clj,.cljs,.cljc,.edn}")` search all clj file-paths in pwd directory
(search-in-parents dir file-or-dir)
Search file-or-dir
in the parents directories of dir
.
Search `file-or-dir` in the parents directories of `dir`.
(to-src-dst copy-actions)
Turns copy-action
into a list of pairs containing the source file first and destination file then.
Turns `copy-action` into a list of pairs containing the source file first and destination file then.
(write-file filename content)
Write the text file filename
with its content
.
Returns the nil if succesful, map with :exception otherwise
Write the text file `filename` with its `content`. Returns the nil if succesful, map with :exception otherwise
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close