Interface to ‘directory’ package for users of ‘path’

Version on this page:1.8.1@rev:1
LTS Haskell 22.26:1.8.2
Stackage Nightly 2024-06-22:1.8.2
Latest on Hackage:1.8.2

See all snapshots path-io appears in

BSD-3-Clause licensed and maintained by Mark Karpov
This version can be pinned in stack with:path-io-1.8.1@sha256:5f75cbea84d9d0c0cef5e65b70bea412af9708e7f851b1af2a5038335d724f24,2142

Module documentation for 1.8.1

Path IO

License BSD3 Hackage Stackage Nightly Stackage LTS CI

This package provides an interface to the directory package for users of path. It also implements some extra functionality like recursive scanning and copying of directories, working with temporary files/directories, etc.

Consult Haddocks for usage, which should be trivial.


Issues, bugs, and questions may be reported in the GitHub issue tracker for this project.

Pull requests are also welcome.


Copyright © 2016–present Mark Karpov

Distributed under BSD 3 clause license.


Path IO follows SemVer.

Path IO 1.8.1

  • Fixed a “permission denied” error occurring when copyDirRecur is used to copy a tree with non-empty read-only directories. PR 82.

Path IO 1.8.0

  • Added instances of AnyPath for SomeBase. PR 72.

Path IO 1.7.0

  • Added doesPathExist, getFileSize, renamePath, and removePathForcibly.

Path IO 1.6.3

  • Fixed a bug that caused removeDirLink fail on Linux because of a trailing slash that used to be passed to the underlying removeDirectoryLink function from the directory package. Issue 59.

  • Works with GHC 9.0.1.

Path IO 1.6.2

  • Fixed a bug in the findFilesWith and based on it findFiles functions.

Path IO 1.6.1

  • Fixed a space leak in walkDirAccum. Issue 55.

Path IO 1.6.0

  • Changed how copyDirRecur and copyDirRecur' functions work. Previously, the functions created empty directories in the destination directory when the source directory contained directory symlinks. The symlinked directories were not recursively traversed. It also copied symlinked files creating normal regular files in the target directory as the result. This is fixed so that the function now behaves much like the cp utility, not traversing symlinked directories, but recreating symlinks in the target directory according to their targets in the source directory.

  • Fixed a bug in createDirLink which would always fail complaining that its destination location does not exist.

  • Dropped support for GHC 8.2.

Path IO 1.5.0

  • Dropped support for GHC 8.0 and older.
  • Added new functions: getXdgDirList, createFileLink, createDirLink, removeDirLink, getSymlinkTarget.

Path IO 1.4.2

  • Fixed various bugs in listDirRecurRel, walkDirRel, and walkDirAccumRel and clarified their behavior in the docs.

Path IO 1.4.1

  • Fixed a bug in walkDirRel that resulted in NotAProperPrefix exception every time the function was called.

Path IO 1.4.0

  • Added relative versions of some actions: listDirRel, listDirRecurRel, walkDirRel, and walkDirAccumRel.

  • Dropped support for GHC 7.8.

Path IO 1.3.3

  • (Hopefully) fixed test suite failure with Cabal 2.0 and GHC 8.2.1.

Path IO 1.3.2

  • Reduce a number of (MonadIO m, MonadThrow m) constraints to just MonadIO m #27

Path IO 1.3.1

  • Made listDirRecur faster for deep directory trees.

Path IO 1.3.0

  • Change the default behavior of recursive traversal APIs to not follow symbolic links. The change affects the following functions: listDirRecur, copyDirRecur, and copyDirRecur'.

  • Add isSymlink which allows to test whether a path is a symbolic link.

  • Move the type functions AbsPath and RelPath to the AnyPath type class (previously they were standalone closed type families, now they are associated types of AnyPath).

  • Improved the documentation and metadata.

Path IO 1.2.3

  • Allowed time-1.7.

Path IO 1.2.2

  • Fixed a bug in setModificationTime function that previously called setAccessTime instead of setModificationTime from directory.

  • Added notes to all pieces of API that are conditional (some functions are only available if directory- or later is used, now it’s mentioned for every such function explicitely).

Path IO 1.2.1

  • Allowed directory-

  • Added getXdgDir. Only available of directory- or later is used.

  • Various cosmetic improvements.

Path IO 1.2.0

  • Added walkDir function to traverse a directory tree with a handler.

  • Added walkDirAccum function which is like walkDir but also accepts an output writer and returns the accumulated output.

  • All recursive traversal functions (existing and new) now safely handle directory loops due to symbolic or hard links.

  • Added “since” notes to public functions in API.

Path IO 1.1.0

  • Fixed bug in copyDirRecur when it was unable to fully copy read-only directories.

  • Added copyDirRecur' function that works just like copyDirRecur, but does not preserve directory permissions.

Path IO 1.0.1

  • Fixed bug in copyDirRecur for non-existing destination paths when directory to copy does not contain sub-directories.

  • Made copyDirRecur try to copy permissions for destination directory too (previously it only tried to copy them for sub-directories).

Path IO 1.0.0

  • Changed signature of getAppUserDataDir, so it takes String as the first argument.

  • Removed deprecated forgivingAbsence' function.

  • Made findFile lazier, it stops searching as soon as a file is found.

  • Added some tests.

Path IO 0.3.1

  • Introduced synonym for forgivingAbsence'ignoringAbsence. forgivingAbsence' is deprecated now, but it’s still there.

  • Added a handy shortcut ensureDir that is defined as ensureDir = createDirIfMissing True.

  • Made getHomeDir and getTempDir more robust when they are influenced by values of environment variables.

Path IO 0.3.0

  • Added forgivingAbsence, resolveFile, and resolveDir functions, so the package now provides all functionality that Path.IO module in Stack has.

  • Added closed type family RelPath, makeRelative, and makeRelativeToCurrentDir functions.

  • Fixed signature of getAppUserDataDir.

Path IO 0.2.0

  • Added functions from temporary: withTempFile, withTempDir, withSystemTempFile, withSystemTempDir, openTempFile, openBinaryTempFile, and createTempDir. temporary is a lightweight and ubiquitous package, so depending on it should be OK.

Path IO 0.1.1

  • Fixed type signatures of renameFile and copyFile.

Path IO 0.1.0

  • Initial release.