public class FileManipulator extends Object
Constructor and Description |
---|
FileManipulator() |
Modifier and Type | Method and Description |
---|---|
static void |
copyDir(File srcDir,
File dstDir)
Copies all files under srcDir to dstDir.
|
static void |
copyFile(File src,
File dst)
Copies src file to dst file.
|
static void |
copyFileToDir(File src,
File dst)
Copies src file to dst directory.
|
static boolean |
deleteDir(File dir)
Deletes all files and subdirectories under dir.
|
static void |
deleteDir(String directory) |
static File[] |
getMatchingFiles(String sourceDir,
String fileNamePrefix,
String extension)
Get the list of file with a prefix of
fileNamePrefix & an extension of
extension |
public static boolean deleteDir(File dir)
dir
- The directory to be deletedpublic static void copyDir(File srcDir, File dstDir) throws IOException
srcDir
- The source dirdstDir
- The destination dirIOException
- If an error occrs while copyingpublic static void copyFile(File src, File dst) throws IOException
src
- The source filedst
- The destiination fileIOException
- If an Exception occurs while copyingpublic static void copyFileToDir(File src, File dst) throws IOException
src
- The file to be copieddst
- The destination directory to which the file has to be copiedIOException
- If an error occurs while copyingpublic static File[] getMatchingFiles(String sourceDir, String fileNamePrefix, String extension)
fileNamePrefix
& an extension of
extension
sourceDir
- The directory in which to search the filesfileNamePrefix
- The prefix to look forextension
- The extension to look forfileNamePrefix
& an extension of
extension
public static void deleteDir(String directory)
directory
- The directory to be deleteddeleteDir(File)
Copyright © 2016 WSO2 Inc. All rights reserved.