module Unixutil: sig end
This module provides various helpful utilities for use with the built-in
Unix module.
Author(s): Copyright (C) 2004 John Goerzen
File functions
|
val exists : string -> bool
Directory processing
|
val list_of_dir : string -> string listval fold_directory : ('a -> string -> 'a) -> 'a -> string -> 'aval recurse_stream : string -> (string * Unix.stats) Stream.trecurse_stream name will create a stream that yields a (stats, name)
pair for every entry beneath the given filename (including the
filename itself. It's a depth-first traversal.
The stats are included because a lot of people want to check on the type of file for each file in the list. You can see if you have a directory by:
match stats.st_kind with
S_DIR -> ...
| _ -> ...
val recurse_list : string -> (string * Unix.stats) listUnixutil.recurse_stream, but generates a list instead.
Not recommended since this list could be *huge*.val recurse_cmd : (string * Unix.stats -> unit) -> string -> unitrecurse_cmd func name will call func stats name on every entry
in or beneath name, which may specify a directory or a file. For entries
in subdirectires, the full relative path starting from name will be
passed.
Shell replacements
|
val rm : ?recursive:bool -> ?force:bool -> string -> unitBy default, will remove only a given file and will raise an error if it fails to do so.
if ~force is given and is set true, errors are never raised but simply ignored.
If ~recursive is given and is set true, a directory
name may be given. The directory and all entries beneath it will
be removed.