ZVON > References > Haskell reference
| Indexes | Syntax | Prelude | Ratio | Complex | Numeric | Ix | Array | List | Maybe | Char | Monad | IO | >> Directory << | System | Time | Locale | CPUTime | Random

Module: Directory
Function: renameDirectory
Type: FilePath -> FilePath -> IO ()
Description: renameDirectory old new changes the name of an existing directory from old to new. If the new directory already exists, it is atomically replaced by the old directory. If the new directory is neither the old directory nor an alias of the old directory, it is removed as if by removeDirectory. A conformant implementation need not support renaming directories in all situations (for instance, renaming to an existing directory, or across different physical devices), but the constraints must be documented.
Related:

Example 1
Program source: 

import Directory

main = do createDirectory "/tmp/BAR"
	  a <- doesDirectoryExist "/tmp/BAR"
	  renameDirectory "/tmp/BAR" "/tmp/FOO"
	  b <- doesDirectoryExist "/tmp/BAR"
	  c <- doesDirectoryExist "/tmp/FOO"
	  print (a,b,c)

Output: (True,False,True)