File system operations

Arc has operations to manipulate files and directories. These operations do not all work on non-Unix systems. The I/O operations are closely related to MzScheme's I/O operations.

See I/O in Arc for information on reading and writing files.

ensure-dir path
Creates the specified directory, if it doesn't exist.
>(ensure-dir "newdir")
nil
dir path
Returns the directory contents as a list.
>(dir "mydir")
Error: directory-list: could not open directory
  path: /hom
e/agaram/Desktop/minilangs/arcsite/_ref/mydir
  system error
: No such file or directory; errno=2

dir-exists path
Tests if a directory exists.
>(dir-exists "mydir")
nil
file-exists path
Tests if a file exists.
>(file-exists "mydir")
nil
mvfile path
Moves the specified file. New in arc3.
>(mvfile "/tmp/junk" "/tmp/newjunk")
nil
rmfile path
Removes the specified file.
>(rmfile "/tmp/newjunk")
Error: delete-file: cannot delete file
  path: /tmp/newjunk

  system error: No such file or directory; errno=2

rmfile path
Removes the specified file.
>(rmfile "oldfile")
nil

Copyright 2008 Ken Shirriff.