Liking cljdoc? Tell your friends :D

automaton-core.adapters.files

Tools to manipulate local files Is a proxy to babashka.fs tools

Tools to manipulate local files
Is a proxy to babashka.fs tools
raw docstring

absolutizeclj

(absolutize relative-path)

Transform a file or dir name in an absolute path

Transform a file or dir name in an absolute path
raw docstring

add-suffixclj

(add-suffix filename suffix)

Add a suffix of the filename before the extension

Add a suffix of the filename before the extension
raw docstring

change-extensionclj

(change-extension file-name new-extension)

Change the extension

Change the extension
raw docstring

compare-pathsclj

(compare-paths path1 path2)

Are the paths pointing to the same directory? Params:

  • path1
  • path2
Are the paths pointing to the same directory?
Params:
* `path1`
* `path2`
raw docstring

copy-files-or-dirclj

(copy-files-or-dir files target-dir)

Copy the files, even if they are directories to the target

  • files is a sequence of file or directory name, in absolute or relative form
  • target-dir is where files are copied to
Copy the files, even if they are directories to the target
* `files` is a sequence of file or directory name, in absolute or relative form
* `target-dir` is where files are copied to
raw docstring

create-dir-pathclj

(create-dir-path & dirs)

Creates a path with the list of parameters. Removes the empty strings, add needed separators, including the trailing ones

Creates a path with the list of parameters.
Removes the empty strings, add needed separators, including the trailing ones
raw docstring

create-dirsclj

(create-dirs dir)

Create a directory

Create a directory
raw docstring

create-file-pathclj

(create-file-path & dirs)

Creates a path with the list of parameters. Removes the empty strings, add needed separators

Creates a path with the list of parameters.
Removes the empty strings, add needed separators
raw docstring

create-temp-dirclj

(create-temp-dir & sub-dirs)

Creates a temporary directory managed by the system Params:

  • sub-dirs is an optional list of strings, each one is a sub directory Returns the string of the directory path
Creates a temporary directory managed by the system
Params:
* `sub-dirs` is an optional list of strings, each one is a sub directory
Returns the string of the directory path
raw docstring

delete-filesclj

(delete-files file-list)

Deletes the files which are given in the list. They could be regular files or directory, when so the whole subtreee will be removed

Deletes the files which are given in the list.
They could be regular files or directory, when so the whole subtreee will be removed
raw docstring

delete-files-starting-withclj

(delete-files-starting-with files-map starting-regexp)

Remove all files matching:

  • files-map where the files are searched
  • starting-regexp is a regular expression matching the first line of the file
Remove all files matching:
* `files-map` where the files are searched
* `starting-regexp` is a regular expression matching the first line of the file 
raw docstring

directory-exists?clj

(directory-exists? directory-path)

Check directory existance

Check directory existance
raw docstring

directory-separatorclj

Symbol to separate directories. Is usually / on linux based OS And \ on windows based ones

Symbol to separate directories.
Is usually `/` on linux based OS And `\` on windows based ones
raw docstring

empty-path?clj

(empty-path? dir)

Is the directory empty Params:

  • dir the directory to search in
Is the directory empty
Params:
* `dir` the directory to search in
raw docstring

ensure-directory-existsclj

(ensure-directory-exists dir)

If directory doesn't exist, create it. Params:

  • dir directory to check
If directory doesn't exist, create it.
Params:
* `dir` directory to check
raw docstring

extract-pathclj

(extract-path filename)

Extract if the filename is a file, return the path that contains it, otherwise return the path itself

Extract if the filename is a file, return the path that contains it,
otherwise return the path itself
raw docstring

file-in-same-dirclj

(file-in-same-dir source-file relative-name)

Use the relative-name to create in file in the same directory than source-file

Use the relative-name to create in file in the same directory than source-file
raw docstring

file-izedclj

(file-ized namespace)

Transform a name, like a namespace name or application name, in a directory compatible names

Transform a name, like a namespace name or application name, in a directory compatible names
raw docstring

file-nameclj

(file-name path)

Return the file name without the path

Return the file name without the path
raw docstring

file-prefixclj

(file-prefix path)

Adds file: as a prefix to the string. Usefull when java io resource type of path is needed

Adds `file:` as a prefix to the string. Usefull when java io resource type of path is needed
raw docstring

filter-existing-dirclj

(filter-existing-dir dirs)

Filter only existing dirs Params:

  • dirs sequence of string of directories
Filter only existing dirs
Params:
* `dirs` sequence of string of directories
raw docstring

for-eachclj

(for-each dir fn-each)

Apply fn-each on each files in a directory

Apply fn-each on each files in a directory
raw docstring

hidden?clj

(hidden? path)

Return true if the path is hidden

Return true if the path is hidden
raw docstring

is-existing-dir?clj

(is-existing-dir? path)

Check if this the path exist and is a directory

Check if this the path exist and is a directory
raw docstring

is-existing-file?clj

(is-existing-file? path)

Check if this the path exist and is not a directory

Check if this the path exist and is not a directory
raw docstring

list-subdirclj

(list-subdir root)

List subdirectories

List subdirectories
raw docstring

modified-sinceclj

(modified-since anchor file-set)

Return true if anchor is older than one of the file in file-set

Return true if anchor is older than one of the file in file-set
raw docstring

read-fileclj

(read-file target-filename)

Read the file target-filename

Read the file `target-filename`
raw docstring

relativizeclj

(relativize path root-dir)

Turn the path into a relative directory starting from root-dir

Turn the `path` into a relative directory starting from `root-dir`
raw docstring

remove-fileclj

(remove-file filename)

Remove the file filename

Remove the file `filename`
raw docstring

remove-trailing-separatorclj

(remove-trailing-separator path)

If exists, remove the trailing separator in a path, remove unwanted spaces either

If exists, remove the trailing separator in a path, remove unwanted spaces either
raw docstring

rename-dirclj

(rename-dir src dst)

Rename a dir

Rename a dir
raw docstring

rename-fileclj

(rename-file src dst)

Rename a file src to destination file dst

Rename a file `src` to destination file `dst`
raw docstring

rename-recursivelyclj

(rename-recursively target-dir file-filter pattern pattern-replacement)

Search recursively all sub-dirs to be renamed from template-app in the target-dir directory

Search recursively all sub-dirs to be renamed from `template-app` in the `target-dir` directory
* `target-dir` is the root directory of the searched files
* `file-filter` filter for files, [according to syntax in crate regexp](https://docs.rs/regex/1.9.1/regex/#syntax).
* `pattern` is to find content in the namespace, for instance, as seen in [java pattern](https://docs.oracle.com/javase/10/docs/api/java/util/regex/Pattern.html), e.g. #"foo(.*)bar"
* `pattern-replacement` is what to replace, according to the [replace specification](https://clojuredocs.org/clojure.string/replace). e.g. "foo_$1_bar" 
raw docstring

search-filesclj

(search-files root pattern)
(search-files root pattern options)

Search files.

  • root is where the root directory of the search-files
  • pattern is a regular expression as described in java doc
  • options (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 files in pwd directory
Search files.
* `root` is where the root directory of the search-files
* `pattern` is a regular expression 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 files in pwd directory
raw docstring

write-fileclj

(write-file filename content)

Spit the file, the directory where to store the file is created if necessary

  • filename is the name of the file to write, could be absolute or relative
  • content is the content to store there
Spit the file, the directory where to store the file is created if necessary
* `filename` is the name of the file to write, could be absolute or relative
* `content` is the content to store there
raw docstring

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

× close