(assert-files? coll)
(assert-files? regex)
(assert-files? file-glob)
Assert that the files (including directories) designated by DESIGNATOR exist. If not, collect all those that do not and raise an ex-info exeception :type :no-such-files :files <set of names>.
DESIGNATOR can be a collection, regex or string. If a collection, each element is taken as a full path of a file; if regex, uses re-directory-files to obtain a collection of paths; if string, treat as file glob and use fs/glob to obtain collection of paths. Check all elements of resulting collection with fs/exists?
Assert that the files (including directories) designated by DESIGNATOR exist. If not, collect all those that do not and raise an ex-info exeception :type :no-such-files :files <set of names>. DESIGNATOR can be a collection, regex or string. If a collection, each element is taken as a full path of a file; if regex, uses re-directory-files to obtain a collection of paths; if string, treat as file glob and use fs/glob to obtain collection of paths. Check all elements of resulting collection with fs/exists?
(basename path)
Return basename (file part) of path. (basename "/a/b/c") -> "c"
Return basename (file part) of path. (basename "/a/b/c") -> "c"
(cd dir)
Change working directory to DIR and return previous working directory. If DIR does not exist do nothing and return nil
Change working directory to DIR and return previous working directory. If DIR does not exist do nothing and return nil
(copy from to)
(cpfiles dirdir outdir regex file-type)
Copy a set of files from a set of dirs DIRDIR to an output dir OUTDIR.
FILE-TYPE is the type of files in each dir in DIRDIR that are candidates to be copied. REGEX is a regular expression to filter the set of candidates
EX: (cpfiles "/data2/Bio/Training/MoStos2" "/home/jsa/TMP/X" #"firm" ".sto")
Copy a set of files from a set of dirs DIRDIR to an output dir OUTDIR. FILE-TYPE is the type of files in each dir in DIRDIR that are candidates to be copied. REGEX is a regular expression to filter the set of candidates EX: (cpfiles "/data2/Bio/Training/MoStos2" "/home/jsa/TMP/X" #"firm" ".sto")
(directory-files directory file-type)
Return full path qualified file specifications for all files in directory whose suffix matches file-type. Typically file-type would be the type suffix (e.g., .txt or .sto or .fna or .clj or whatever), but could include any part of the file name's suffix. So, giving -new.sto for example, works as well.
Return full path qualified file specifications for all files in directory whose suffix matches file-type. Typically file-type would be the type suffix (e.g., .txt or .sto or .fna or .clj or whatever), but could include any part of the file name's suffix. So, giving -new.sto for example, works as well.
(directory? path)
Return true if path is a directory.
Return true if path is a directory.
(dirname path)
Return directory name of path. (dirname "a/b/c") -> "/a/b"
Return directory name of path. (dirname "a/b/c") -> "/a/b"
(dodir dir filterf actionf & args)
Map ACTIONF over application of FILTERF to DIR.
FILTERF is a function that operates on a directory returning a result set (typically a set of files). ACTIONF is a function that takes an element of the set and any ancillary supplied arguments ARGS and returns an appropriate result.
Returns the seq of results of ACTIONF minus any nils
Map ACTIONF over application of FILTERF to DIR. FILTERF is a function that operates on a directory returning a result set (typically a set of files). ACTIONF is a function that takes an element of the set and any ancillary supplied arguments ARGS and returns an appropriate result. Returns the seq of results of ACTIONF minus any nils
(empty? path)
(executable? path)
Return true if path is executable.
Return true if path is executable.
(file arg)
(file parent child)
(file parent child & more)
Returns a java.io.File from string or file args.
Returns a java.io.File from string or file args.
(ftype path)
Return the file type suffix of PATH. File type suffix is the last substring element following a '.' in (basename PATH). If no such element is in the basename, returns empty string""
Ex: (ftype "/home/fred/Bio/test.sto") ==> "sto"
Return the file type suffix of PATH. File type suffix is the last substring element following a '.' in (basename PATH). If no such element is in the basename, returns empty string"" Ex: (ftype "/home/fred/Bio/test.sto") ==> "sto"
(fullpath filespec-str)
Canonicalize FILESPEC, a string, to a fully qualified file path for the native system. ~ in position one is translated to the users home directory path, / and \ are translated to the file separator for the native system.
Canonicalize FILESPEC, a string, to a fully qualified file path for the native system. ~ in position one is translated to the users home directory path, / and \ are translated to the file separator for the native system.
(glob pattern)
(glob->regex s)
Takes a glob-format string and returns a regex.
Takes a glob-format string and returns a regex.
(join & parts)
Join parts of path. (join ["a" "b"]) -> "a/b"
Join parts of path. (join ["a" "b"]) -> "a/b"
(move coll newdir)
(move regex newdir)
(move file-glob newdir)
Move the files (including directories) designated by DESIGNATOR to the directory NEWDIR. DESIGNATOR can be collection, regex or string. If a collection, each element is taken as a full path of a file; if regex, uses re-directory-files to obtain a collection of paths; if string, treat as file glob and use fs/glob to obtain collection of paths. Move all elements of resulting collection to newdir.
Move the files (including directories) designated by DESIGNATOR to the directory NEWDIR. DESIGNATOR can be collection, regex or string. If a collection, each element is taken as a full path of a file; if regex, uses re-directory-files to obtain a collection of paths; if string, treat as file glob and use fs/glob to obtain collection of paths. Move all elements of resulting collection to newdir.
(normpath path)
Return nomralized (canonical) path.
Return nomralized (canonical) path.
(pop)
Pop current top saved directory from directory stack, make it the current working directory, and return prior working directory. If directory stack is empty, do nothing and return nil.
Pop current top saved directory from directory stack, make it the current working directory, and return prior working directory. If directory stack is empty, do nothing and return nil.
(push dir)
Push current working directory on directory stack, cd to DIR, and return previous (saved) working directory. If DIR does not exist do nothing and return nil.
Push current working directory on directory stack, cd to DIR, and return previous (saved) working directory. If DIR does not exist do nothing and return nil.
(pwd)
Return current working directory path
Return current working directory path
(re-directory-files directory re)
Return full path qualified file specifications for all files in directory whose name ends with a string matched by re. RE is a regexp (#"regex def" literal or a string that defines a regexp (which will be turned into a pattern).
Return full path qualified file specifications for all files in directory whose name ends with a string matched by re. RE is a regexp (#"regex def" literal or a string that defines a regexp (which will be turned into a pattern).
(readable? path)
Return true if path is readable.
Return true if path is readable.
(rename old-path new-path)
Rename old-path to new-path.
Rename old-path to new-path.
(replace-type filespec ext)
Replace the file extension type of FILESPEC to be EXT. The type for FILESPEC is the last part dotted extension. Formally, matches regexp '.[^.]*$'. If EXT is a seq/vec replace extensions in last/first pairings. Last extension replace by (first EXT), then last of that result is replaced by (second EXT), etc.
Replace the file extension type of FILESPEC to be EXT. The type for FILESPEC is the last part dotted extension. Formally, matches regexp '\.[^.]*$'. If EXT is a seq/vec replace extensions in last/first pairings. Last extension replace by (first EXT), then last of that result is replaced by (second EXT), etc.
(rm file)
Remove a file. Will throw an exception if the file cannot be deleted.
Remove a file. Will throw an exception if the file cannot be deleted.
(rm-f file)
Remove a file, ignoring any errors.
Remove a file, ignoring any errors.
(rm-r path & [silently])
Remove a directory. The directory must be empty; will throw an exception if it is not or if the file cannot be deleted.
Remove a directory. The directory must be empty; will throw an exception if it is not or if the file cannot be deleted.
(rm-rf path)
Remove a directory, ignoring any errors.
Remove a directory, ignoring any errors.
(split path)
Split path to componenets. (split "a/b/c") -> ("a" "b" "c")
Split path to componenets. (split "a/b/c") -> ("a" "b" "c")
(symbolic-link? path)
Return true if path denotes a symbolic link, false otherwise
Return true if path denotes a symbolic link, false otherwise
(tempdir)
(tempdir root)
Create a temporary directory
Create a temporary directory
(tempfile)
(tempfile prefix)
(tempfile prefix suffix)
(tempfile prefix suffix directory)
Create a temporary file.
Create a temporary file.
(writeable? path)
Return true if path is writeable.
Return true if path is writeable.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close