This project is read-only.

Commons IO : FileUtils


This utility provides a set of facilities for file manipulation.

Facilities are provided in the following areas:
  • writing to a file with content either in byte[], char[] or string
  • reading from a file
  • copying files and directories (deep recursive)
  • deleting files and directories (deep recursive)
  • converting to and from a URL
  • comparing file content
  • modify file last changed date by "touching" it

Method Summary

Name Description
CleanDirectory Clean a directory without deleting it
CombinePaths Combines two path strings.
Compare This method compares the content of 2 files.
DisplaySize Returns a human-readable version of the file size (original is in bytes).
GetDirectoryFileInfo Gets information about the files in a directory and puts it in an array of strings.
GetFileLength Checks if the giving File exists, and returns its length
GetFiles Returns an array of abstract pathnames representing the files and directories of the specified path.
GetFilesInDirectory Get an array of files info from a directory.
GetFilesMatchWildCard Get all the files that matches a wildcard pattern, eg. (*.tmp)
GetFullPath Returns Absolute Path (Fix for 260 Char Limit of Path.GetFullPath(...))
GetRelativePath Get Relative Path
IsDirectory Determine if a path provided is the path of a file
IsHidden Determine if a file provided is hidden
IsNewer Tests if the specified file is newer than the reference file.
IsWriteable Checks if a file have write permissions
ReadBinaryFile Read binary context of a file.
ReadTextFile Read the content of the text file.
Remove Remove a file or similar files if wildcard is included.
RemoveAll Remove a file or Directory recursively
Save Save content into a file
SetReadOnly Sets the read-only property of the file to true.
SplitPath Split the path into array of string
ToFileFromUri Convert from a URL to a FileInfo.
Touch Implements the same behaviour as the "touch" utility on Unix. It creates a new file with size 0 or, if the file exists already, it is opened and closed without modifying it, but updating the file date and time.
ToUri Creates an instance of System.Uri class with the pech specified
Write Write content to a file. See 'Save' above.

Last edited May 20, 2007 at 6:36 PM by JoeBlack, version 1


No comments yet.