class Copyfiles extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) static java.util.Comparator<java.io.File> |
fileComp
A comparator on File comparing base names.
|
(package private) java.lang.String |
fromBase |
(package private) java.lang.String |
toBase |
Constructor and Description |
---|
Copyfiles(java.io.File from,
java.io.File to)
Make two directories equal by recursively copying files with
differing content.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
copyDirectories(java.io.File fromDir,
java.io.File toDir)
Mirror two directories - both arguments must be directories and
the destination directory must exist.
|
(package private) static boolean |
copyFile(java.io.File from,
java.io.File to)
Copies a file creating or replacing the destination file as
necessary.
|
(package private) static boolean |
delete(java.io.File file)
This method deletes the specified directory.
|
(package private) static boolean |
equalDate(java.io.File x,
java.io.File y)
Compare modification times and return true if less than 2 seconds
different.
|
(package private) static boolean |
equalFile(java.io.File x,
java.io.File y)
Does a byte for byte comparison of two files.
|
static void |
main(java.lang.String... args)
Copies or mirrors a directory tree.
|
(package private) static void |
mirrorDirectories(java.io.File fromDir,
java.io.File toDir)
Mirror two directories - both arguments must be directories and
the destination directory must exist.
|
(package private) static java.lang.String |
relativePath(java.lang.String prefix,
java.lang.String absolute)
Return a relative path relative to the given absolute path.
|
static java.util.Comparator<java.io.File> fileComp
java.lang.String fromBase
java.lang.String toBase
Copyfiles(java.io.File from, java.io.File to)
from
- the source directory for the copyto
- the destination directory for the copystatic boolean equalFile(java.io.File x, java.io.File y)
x
- first file to comparey
- second file to comparestatic boolean equalDate(java.io.File x, java.io.File y)
x
- first file to comparey
- second file to comparestatic boolean copyFile(java.io.File from, java.io.File to)
from
- source file of copyto
- destination file of copystatic java.lang.String relativePath(java.lang.String prefix, java.lang.String absolute)
prefix
- the prefix to be stripped off of the pathabsolute
- the path to be strippedvoid copyDirectories(java.io.File fromDir, java.io.File toDir)
fromDir
- the source directory for the copytoDir
- the destination directory for the copystatic void mirrorDirectories(java.io.File fromDir, java.io.File toDir)
fromDir
- the source directory for the copytoDir
- the destination directory for the copystatic boolean delete(java.io.File file)
file
- the file or directory to be deletedpublic static void main(java.lang.String... args)
args
- the command line arguments.