it.eng.spagobi.commons.utilities
Class FileUtilities

java.lang.Object
  extended by it.eng.spagobi.commons.utilities.FileUtilities

public class FileUtilities
extends java.lang.Object

Author:
Zerbetto (davide.zerbetto@eng.it)

Constructor Summary
FileUtilities()
           
 
Method Summary
static void copyDirectory(java.io.File sourceDir, java.io.File destDir, boolean recursive, boolean overwrite, boolean renamePrevious)
          Copy all files and contained directories (if recursive is true) in the source directory into the destination directory.
static void copyDirectory(java.lang.String sourceDirStr, java.lang.String destDirStr, boolean recursive, boolean overwrite, boolean renamePrevious)
          Copy all files and contained directories (if recursive is true) in the source directory into the destination directory.
static boolean copyFile(java.io.File toBeCopied, java.io.File toDir, boolean overwrite, boolean renamePrevious)
           
static boolean deleteDir(java.io.File dir)
          Delete a folder and its contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileUtilities

public FileUtilities()
Method Detail

copyFile

public static boolean copyFile(java.io.File toBeCopied,
                               java.io.File toDir,
                               boolean overwrite,
                               boolean renamePrevious)

copyDirectory

public static void copyDirectory(java.lang.String sourceDirStr,
                                 java.lang.String destDirStr,
                                 boolean recursive,
                                 boolean overwrite,
                                 boolean renamePrevious)
                          throws java.lang.Exception
Copy all files and contained directories (if recursive is true) in the source directory into the destination directory.

Parameters:
sourceDir - The String representing the source directory
destDir - The String representing the destination directory
recursive - Boolean: if it is true, contained directories are copied also recursively
overwrite - Boolean: if it is true, contained files are overwritten
Throws:
java.lang.Exception

copyDirectory

public static void copyDirectory(java.io.File sourceDir,
                                 java.io.File destDir,
                                 boolean recursive,
                                 boolean overwrite,
                                 boolean renamePrevious)
                          throws java.lang.Exception
Copy all files and contained directories (if recursive is true) in the source directory into the destination directory.

Parameters:
destDir - The destination directory File
sourceDir - The source directory File
recursive - Boolean: if it is true, contained directories are copied also recursively
overwrite - Boolean: if it is true, contained files are overwritten
Throws:
java.lang.Exception

deleteDir

public static boolean deleteDir(java.io.File dir)
Delete a folder and its contents.

Parameters:
dir - The java file object of the directory
Returns:
the result of the operation