removeFile

removeFile file removes the directory entry for an existing file file, where file is not itself a directory. The implementation may specify additional constraints which must be satisfied before a file can be removed (e.g. the file may not be in use by other processes). The operation may fail with:
  • HardwareFault A physical I/O error has occurred. [EIO]
  • InvalidArgument The operand is not a valid file name. [ENAMETOOLONG, ELOOP]
  • isDoesNotExistError The file does not exist. [ENOENT, ENOTDIR]
  • isPermissionError The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]
  • UnsatisfiedConstraints Implementation-dependent constraints are not satisfied. [EBUSY]
  • InappropriateType The operand refers to an existing directory. [EPERM, EINVAL]
removeFile file removes the directory entry for an existing file file, where file is not itself a directory. The implementation may specify additional constraints which must be satisfied before a file can be removed (e.g. the file may not be in use by other processes). The operation may fail with:
  • HardwareFault A physical I/O error has occurred. [EIO]
  • InvalidArgument The operand is not a valid file name. [ENAMETOOLONG, ELOOP]
  • isDoesNotExistError The file does not exist. [ENOENT, ENOTDIR]
  • isPermissionError The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]
  • UnsatisfiedConstraints Implementation-dependent constraints are not satisfied. [EBUSY]
  • InappropriateType The operand refers to an existing directory. [EPERM, EINVAL]
Lifted removeFile.
removeFile file removes the directory entry for an existing file file, where file is not itself a directory. The implementation may specify additional constraints which must be satisfied before a file can be removed (e.g. the file may not be in use by other processes). The operation may fail with:
  • HardwareFault A physical I/O error has occurred. [EIO]
  • InvalidArgument The operand is not a valid file name. [ENAMETOOLONG, ELOOP]
  • isDoesNotExistError / NoSuchThing The file does not exist. [ENOENT, ENOTDIR]
  • isPermissionError / PermissionDenied The process has insufficient privileges to perform the operation. [EROFS, EACCES, EPERM]
  • UnsatisfiedConstraints Implementation-dependent constraints are not satisfied. [EBUSY]
  • InappropriateType The operand refers to an existing directory. [EPERM, EINVAL]
Remove a file. This will fail if the file does not exist. This computation cannot remove directories. For that, use removeDirectory or removeTree. This computation throws IOError on failure. See “Classifying I/O errors” in the System.IO.Error documentation for information on why the failure occured.
Remove a file. This function internally calls unlink. If the file does not exist, an exception is thrown.
Remove all files and directories that match any of the patterns within a directory. Some examples:
removeFiles "output" ["//*"]        -- delete everything inside 'output'
removeFiles "output" ["//"]         -- delete 'output' itself
removeFiles "." ["//*.hi","//*.o"] -- delete all '.hi' and '.o' files
If the argument directory is missing no error is raised. This function will follow symlinks, so should be used with care. This function is often useful when writing a clean action for your build system, often as a phony rule.
Remove files, like removeFiles, but executed after the build completes successfully using runAfter. Useful for implementing clean actions that delete files Shake may have open for building, e.g. shakeFiles. Where possible, delete the files as a normal part of the build, e.g. using liftIO $ removeFiles dir pats.
Lifted version of removeFiles that accepts a well-typed directory.
Lifted version of removeFilesAfter that accepts a well-typed directory.
A function that "tries" to remove a file. If the file does not exist, nothing happens.