|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.util.Deleter
public class Deleter
Utility to delete a file or directory recursively.
Constructor Summary | |
---|---|
Deleter()
|
Method Summary | |
---|---|
static void |
Delete(java.io.File toDelete)
Delete by File. |
static void |
Delete(java.lang.String path)
Delete by path. |
static void |
deleteEmptyParents(java.io.File file,
java.io.File rootDir)
Same behaviour as for Deleter.deleteEmptyParents(File, String) but with the
rootDir parameter specified as a File object. |
static void |
deleteEmptyParents(java.io.File file,
java.lang.String rootDir)
Recursively deletes the parents of the specified file stopping when rootDir is reached. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Deleter()
Method Detail |
---|
public static void Delete(java.lang.String path)
path
- public static void Delete(java.io.File toDelete)
toDelete
- public static void deleteEmptyParents(java.io.File file, java.lang.String rootDir)
rootDir
is reached.
The file itself must have been deleted before calling this method - since only empty
directories can be deleted.
For example: deleteEmptyParents(new File("/tmp/a/b/c/d.txt"), "/tmp/a")
Will delete directories c and b assuming that they are both empty. It will leave /tmp/a even if it is
empty as this is the rootDir
file
- The path of the file whose parent directories should be deleted.rootDir
- Top level directory where deletion should stop. Must be the canonical path
to ensure correct comparisons.public static void deleteEmptyParents(java.io.File file, java.io.File rootDir)
Deleter.deleteEmptyParents(File, String)
but with the
rootDir
parameter specified as a File
object.
file
- rootDir
- Deleter.deleteEmptyParents(File, String)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |