std.fs.api
copy
added in 3.0
(copy source target)(copy source target opts)copies all specified files from one to another
(copy “src” “.src” {:include “.clj”}) => map?
(delete “.src”)
copy-into
added in 3.0
(copy-into source target)(copy-into source target opts)copies a single file to a destination
(copy-into “src/std/fs.clj” “test-scratch/std.fs”) => vector?
(delete “test-scratch/std.fs”)
copy-single
added in 3.0
(copy-single source target)(copy-single source target opts)copies a single file to a destination
(copy-single “project.clj” “test-scratch/project.clj.bak” {:options #{:replace-existing}}) => (path/path “.” “test-scratch/project.clj.bak”)
(delete “test-scratch/project.clj.bak”)
create-directory
added in 3.0
(create-directory path)(create-directory path attrs)creates a directory on the filesystem
(do (create-directory “test-scratch/.hello/.world/.foo”) (path/directory? “test-scratch/.hello/.world/.foo”)) => true
(delete “test-scratch/.hello”)
create-symlink
added in 3.0
(create-symlink path link-to)(create-symlink path link-to attrs)creates a symlink to another file
(do (create-symlink “test-scratch/project.lnk” “project.clj”) (path/link? “test-scratch/project.lnk”)) => true
create-tmpdir
added in 3.0
(create-tmpdir)(create-tmpdir prefix)creates a temp directory on the filesystem
(create-tmpdir) ;;=> #path:“/var/folders/d6/yrjldmsd4jd1h0nm970wmzl40000gn/T/4870108199331749225”
create-tmpfile
added in 3.0
(create-tmpfile)(create-tmpfile contents)creates a tempory file
(create-tmpfile) ;;#file:“/var/folders/rc/4nxjl26j50gffnkgm65ll8gr0000gp/T/tmp2270822955686495575” => java.io.File
delete
added in 3.0
(delete root)(delete root opts)copies all specified files from one to another
(do (copy “src/std/fs.clj” “.src/std/fs.clj”) (delete “.src” {:include “fs.clj”})) => #{(str (path/path “.src/std/fs.clj”))}
(delete “.src”) => set?
list
added in 3.0
(list root)(list root opts)lists the files and attributes for a given directory
(list “src”)
(list “../hara/src/std/fs” {:recursive true})
move
added in 3.0
(move source target)(move source target opts)moves a file or directory
(do (move “shortlist” “.shortlist”) (move “.shortlist” “shortlist”))
(move “.non-existent” “.moved”) => {}
select
added in 3.0
(select root)(select root opts)selects all the files in a directory
(->> (select “src/std/fs”) (map #(path/relativize “std/fs” %)) (map str) (sort))