( ( untyped/unlib/file))
Utilities for manipulating files and paths.
(make-directory-tree tree) →
tree : folders-spec
Creates a directory tree in the current directory that matches tree, which is a tree of strings of type folders-spec:
folders-spec ::= (listof folder-spec)
folder-spec ::= string folders-spec
tree-spec For example, the code:
(make-directory-tree '("a" ("b" "c" ("d"))))
would create the directory tree:
Any existing directories in the tree are left intact.
path : (U )
Returns a filename that is guaranteed to not conflict with the names of any files in path. For example:
(make-non-conflicting-filename ( "mydir") "myfile.txt")
"myfile.txt" if "myfile.txt" doesn’t exist in "mydir";
"myfile1.txt" if "myfile.txt" does exist in "mydir";
"myfile2.txt" if "myfile.txt" and "myfile1.txt" both exist in "mydir";
and so on...
(make-non-conflicting-path path filename) →
path : (U )
Like make-non-conflicting-filename but returns:
( path (make-non-conflicting-filename path filename))
(read-file->string file) →
file : (U )
Reads the contents of file into a string. See the port.plt collection on PLaneT for more advanced functions along these lines.
(concatenate-files dest sources) →
dest : (U )
sources : (listof (U ))
Concatenates (appends) the contents of sources and writes the result to dest.