- README

- Top Level Namespace
- ArgumentError
- Array
- Atomic
- Base64
  - Error
- Benchmark
  - BM
    - Job
    - Tms
  - IPS
    - Entry
    - Job
- BigFloat
- BigInt
- BigRational
- BitArray
- Bool
- Box
- Bytes
- Channel
  - Buffered
  - ClosedError
  - ReceiveAction
  - SelectAction
  - SendAction
  - Unbuffered
- Char
  - Reader
- Class
- Colorize
  - Object
  - ObjectExtensions
- Comparable
- Complex
- Concurrent
  - CanceledError
- Crypto
  - Bcrypt
    - Error
    - Password
  - Blowfish
  - MD5
    - Context
  - Subtle
- CSV
  - Builder
    - Row
  - Error
  - Lexer
  - MalformedCSVError
  - Parser
  - Row
  - Token
    - Kind
- Debug
  - DWARF
    - LineNumbers
      - Register
      - Row
      - Sequence
    - LNE
    - LNS
  - ELF
    - Endianness
    - Error
    - Ident
    - Klass
    - Machine
    - OSABI
    - SectionHeader
      - Flags
      - Type
    - Type
- Deque
- Digest
  - SHA1
- Dir
- DivisionByZero
- DL
- ECR
- Enum
- Enumerable
  - EmptyError
- ENV
- Errno
- Exception
- Fiber
- File
  - Stat
- FileUtils
- Float
  - Primitive
- Float32
- Float64
- GC
  - Stats
- Hash
- HTML
- HTTP
  - Client
    - BodyType
    - Response
  - ComputedContentTypeHeader
  - Cookie
  - Cookies
  - DeflateHandler
  - ErrorHandler
  - Handler
    - Proc
  - Headers
  - LogHandler
  - Params
    - Builder
  - Request
  - Server
    - Context
    - RequestProcessor
    - Response
  - StaticFileHandler
    - DirectoryListing
  - WebSocket
  - WebSocketHandler
- Indexable
- IndexError
- INI
- Int
  - Primitive
  - Signed
  - Unsigned
- Int16
- Int32
- Int64
- Int8
- InvalidByteSequenceError
- IO
  - Buffered
  - ByteFormat
    - BigEndian
    - LittleEndian
    - NetworkEndian
    - SystemEndian
  - Delimited
  - EncodingOptions
  - EOFError
  - Error
  - FileDescriptor
  - Hexdump
  - Memory
  - MultiWriter
  - Seek
  - Sized
  - Timeout
- IPSocket
- Iterable
- Iterator
  - IteratorWrapper
  - Stop
- JSON
  - Any
  - ArrayBuilder
  - Builder
  - Error
  - Lexer
  - ObjectBuilder
  - ParseException
  - Parser
  - PrettyWriter
  - PullParser
  - Token
  - Type
- KeyError
- Levenshtein
  - Finder
- LLVM
  - ABI
    - AArch64
    - ArgKind
    - ArgType
    - ARM
    - FunctionType
    - X86
    - X86_64
      - RegClass
  - AtomicOrdering
  - AtomicRMWBinOp
  - Attribute
  - BasicBlock
  - BasicBlockCollection
  - Builder
  - CallConvention
  - CodeGenFileType
  - CodeGenOptLevel
  - CodeModel
  - Context
  - DIBuilder
  - DwarfTag
  - DwarfTypeEncoding
  - Function
  - FunctionCollection
  - FunctionPassManager
    - Runner
  - GenericValue
  - GlobalCollection
  - InstructionCollection
  - IntPredicate
  - JITCompiler
  - Linkage
  - MemoryBuffer
  - Module
  - ModulePassManager
  - ParameterCollection
  - PassManagerBuilder
  - PassRegistry
  - PhiTable
  - RealPredicate
  - RelocMode
  - Target
  - TargetData
  - TargetMachine
  - Type
    - Kind
  - Value
  - ValueMethods
  - VerifierFailureAction
- Logger
  - Formatter
  - Severity
- Markdown
  - HTMLRenderer
  - Parser
    - PrefixHeader
    - UnorderedList
  - Renderer
- Math
- MemoryIO
- Mutex
- NamedTuple
- Nil
- Number
  - Primitive
- OAuth
  - AccessToken
  - Consumer
  - Error
  - RequestToken
- OAuth2
  - AccessToken
    - Bearer
    - Mac
  - Client
  - Error
  - Session
- Object
- OpenSSL
  - Digest
    - Error
    - UnsupportedError
  - DigestBase
  - Error
  - HMAC
  - MD5
  - SHA1
  - SSL
    - Context
      - Client
      - Server
    - Error
    - ErrorType
    - Modes
    - Options
    - Socket
      - Client
      - Server
    - VerifyMode
    - X509VerifyFlags
  - X509
    - Certificate
    - Extension
    - Name
- OptionParser
  - Exception
  - InvalidOption
  - MissingOption
- PartialComparable
- Pointer
  - Appender
- PrettyPrint
- Proc
- Process
  - Env
  - Status
  - Stdio
  - Tms
- Random
  - MT19937
- Range
- Readline
  - CompletionProc
  - KeyBindingProc
- Reference
- Regex
  - MatchData
  - Options
- SecureRandom
- Set
- Signal
- Slice
- Socket
  - Address
  - Addrinfo
  - Error
  - Family
  - IPAddress
  - Protocol
  - Server
  - Type
  - UNIXAddress
- Spec
  - Expectations
  - Methods
  - ObjectExtensions
- StaticArray
- String
  - Builder
  - RawConverter
- StringPool
- StringScanner
- Struct
- Symbol
- System
- TCPServer
- TCPSocket
- Tempfile
- Termios
  - AttributeSelection
  - BaudRate
  - ControlMode
  - InputMode
  - LineControl
  - LocalMode
  - OutputMode
- Time
  - DayOfWeek
  - EpochConverter
  - EpochMillisConverter
  - Format
    - Error
  - Kind
  - MonthSpan
  - Span
- Tuple
- TypeCastError
- UDPSocket
- UInt16
- UInt32
- UInt64
- UInt8
- Unicode
  - CaseOptions
- Union
- UNIXServer
- UNIXSocket
- URI
  - Error
- Value
- XML
  - Attributes
  - AttributeType
  - Error
  - HTMLParserOptions
  - Namespace
  - Node
  - NodeSet
  - ParserOptions
  - Reader
  - SaveOptions
  - Type
  - XPathContext
- YAML
  - Any
  - Emitter
  - Error
  - EventKind
  - ParseException
  - Parser
  - PullParser
  - Type
- Zlib
  - Deflate
  - Error
  - Inflate

# module FileUtils

## Extended Modules

- FileUtils

## Defined in:

## Instance Method Summary

- #cd(path : String)

  Changes the current working directory of the process to the given string path.

- #cd(path : String, &block)

  Changes the current working firectory of the process to the given string path and invoked the block, restoring the original working directory when the block exits.

- #cmp(filename1 : String, filename2 : String)

  Compares two files filename1 to filename2 to determine if they are identical.

- #cmp(stream1 : IO, stream2 : IO)

  Compares two streams stream1 to stream2 to determine if they are identical.

- #cp(src_path : String, dest : String)

  Copies the file src_path to the file or directory dest.

- #cp(srcs : Enumerable(String), dest : String)

  Copies a list of files src to dest.

- #cp_r(src_path : String, dest_path : String)

  Copies a file or directory src_path to dest_path If src_path is a directory, this method copies all its contents recursively ``` FileUtils.cp_r("src_dir", "src_dir_copy") ```

- #mkdir(path : String, mode = 511) : Nil

  Creates a new directory at the given path.

- #mkdir(paths : Enumerable(String), mode = 511) : Nil

  Creates a new directory at the given paths.

- #mkdir_p(path : String, mode = 511) : Nil

  Creates a new directory at the given path, including any non-existing intermediate directories.

- #mkdir_p(paths : Enumerable(String), mode = 511) : Nil

  Creates a new directory at the given paths, including any non-existing intermediate directories.

- #mv(srcs : Enumerable(String), dest : String) : Nil

  Moves every srcs to dest.

- #mv(src_path : String, dest_path : String) : Nil

  Moves src_path to dest_path.

- #pwd : String

  Returns the current working directory.

- #rm(path : String) : Nil

  Deletes the path file given.

- #rm(paths : Enumerable(String)) : Nil

  Deletes all paths file given.

- #rm_r(path : String) : Nil

  Deletes a file or directory path If path is a directory, this method removes all its contents recursively ``` FileUtils.rm_r("dir") FileUtils.rm_r("file.cr") ```

- #rm_r(paths : Enumerable(String)) : Nil

  Deletes a list of files or directories paths If one path is a directory, this method removes all its contents recursively ``` FileUtils.rm_r(["dir", "file.cr"]) ```

- #rm_rf(path : String) : Nil

  Deletes a file or directory path If path is a directory, this method removes all its contents recursively Ignore all errors.

- #rm_rf(paths : Enumerable(String)) : Nil

  Deletes a list of files or directories paths If one path is a directory, this method removes all its contents recursively Ignore all errors.

- #rmdir(path : String) : Nil

  Removes the directory at the given path.

- #rmdir(paths : Enumerable(String)) : Nil

  Removes all directories at the given paths.

## Instance Method Detail

def cd(path : String) #

Changes the current working directory of the process to the given string path. Alias of Dir.cd.

    require "file_utils"
    FileUtils.cd("to/directory")

def cd(path : String, &block) #

Changes the current working firectory of the process to the given string path and invoked the block, restoring the original working directory when the block exits. Alias of Dir.cd with block.

    FileUtils.cd("to/directory") { puts "Do something useful here!" }

def cmp(filename1 : String, filename2 : String) #

Compares two files filename1 to filename2 to determine if they are identical. Returns true if content are the same, false otherwise.

    FileUtils.cmp("foo.cr", "bar.cr")

def cmp(stream1 : IO, stream2 : IO) #

Compares two streams stream1 to stream2 to determine if they are identical. Returns true if content are the same, false otherwise.

    FileUtils.cmp(stream1 : IO, stream2 : IO)

def cp(src_path : String, dest : String) #

Copies the file src_path to the file or directory dest. If dest is a directory, a file with the same basename as src_path is created in dest Permission bits are copied too.

    FileUtils.cp("file_utils.cr", "file_utils_copy.cr")

def cp(srcs : Enumerable(String), dest : String) #

Copies a list of files src to dest. dest must be an existing directory.

    FileUtils.cp({"cgi.cr", "complex.cr", "date.cr"}, "files")

def cp_r(src_path : String, dest_path : String) #

Copies a file or directory src_path to dest_path If src_path is a directory, this method copies all its contents recursively

    FileUtils.cp_r("src_dir", "src_dir_copy")

def mkdir(path : String, mode = 511) : Nil #

Creates a new directory at the given path. The linux-style permission mode can be specified, with a default of 777 (0o777). Alias of Dir.mkdir

    FileUtils.mkdir("foo")

def mkdir(paths : Enumerable(String), mode = 511) : Nil #

Creates a new directory at the given paths. The linux-style permission mode can be specified, with a default of 777 (0o777).

    FileUtils.mkdir(["foo", "bar"])

def mkdir_p(path : String, mode = 511) : Nil #

Creates a new directory at the given path, including any non-existing intermediate directories. The linux-style permission mode can be specified, with a default of 777 (0o777). Alias of Dir.mkdir_p

    FileUtils.mkdir_p("foo")

def mkdir_p(paths : Enumerable(String), mode = 511) : Nil #

Creates a new directory at the given paths, including any non-existing intermediate directories. The linux-style permission mode can be specified, with a default of 777 (0o777).

    FileUtils.mkdir_p(["foo", "bar"])

def mv(srcs : Enumerable(String), dest : String) : Nil #

Moves every srcs to dest.

    FileUtils.mv(["afile", "foo", "bar"], "src")

def mv(src_path : String, dest_path : String) : Nil #

Moves src_path to dest_path. Alias of File.rename

    FileUtils.mv("afile", "afile.cr")

def pwd : String #

Returns the current working directory. Alias of Dir.current

    FileUtils.pwd

def rm(path : String) : Nil #

Deletes the path file given. Alias of File.delete

    FileUtils.rm("afile.cr")

def rm(paths : Enumerable(String)) : Nil #

Deletes all paths file given.

    FileUtils.rm(["afile.cr", "bfile.cr"])

def rm_r(path : String) : Nil #

Deletes a file or directory path If path is a directory, this method removes all its contents recursively

    FileUtils.rm_r("dir")
    FileUtils.rm_r("file.cr")

def rm_r(paths : Enumerable(String)) : Nil #

Deletes a list of files or directories paths If one path is a directory, this method removes all its contents recursively

    FileUtils.rm_r(["dir", "file.cr"])

def rm_rf(path : String) : Nil #

Deletes a file or directory path If path is a directory, this method removes all its contents recursively Ignore all errors.

    FileUtils.rm_rf("dir")
    FileUtils.rm_rf("file.cr")
    FileUtils.rm_rf("non_existent_file")

def rm_rf(paths : Enumerable(String)) : Nil #

Deletes a list of files or directories paths If one path is a directory, this method removes all its contents recursively Ignore all errors.

    FileUtils.rm_rf(["dir", "file.cr", "non_existent_file"])

def rmdir(path : String) : Nil #

Removes the directory at the given path. Alias of Dir.rmdir

    FileUtils.rmdir("dir")

def rmdir(paths : Enumerable(String)) : Nil #

Removes all directories at the given paths.

    FileUtils.rmdir(["dir1", "dir2", "dir3"])