org.shept.util
Class FileUtils
java.lang.Object
org.shept.util.FileUtils
public class FileUtils
- extends Object
- Version:
- %1
- Author:
- Andreas Hahn
|
Field Summary |
private static org.apache.commons.logging.Log |
log
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
log
private static final org.apache.commons.logging.Log log
FileUtils
public FileUtils()
fileMapByNameAndDate
public static SortedMap<FileNameDate,File> fileMapByNameAndDate(String path,
String filePattern)
- List the file directory as specified by the name filter and the path directory
The maps keys contain name and modification date for comparison
fileMapByDate
public static SortedMap<Calendar,File> fileMapByDate(String path,
String filePattern)
- List the file directory as specified by the name filter and path directory
The maps keys contain modification dat for comparison
- Parameters:
path - filePattern -
- Returns:
fileMapByFilenameDate
public static SortedMap<Calendar,File> fileMapByFilenameDate(String path,
String filePattern)
- List the file directory as specified by the name filter and path directory
The maps keys contain the parsed date from the filename.
The filename can be something like Backup_db_2008_12_01_1350.xyz
The first part is may begin with any character, the first number found
is treated as year followed by month followed by day.
All characters are separated by "_" (underscores).
The last 4-letter number represents hours & minutes
- Parameters:
path - filePattern -
- Returns:
syncAdd
public static Integer syncAdd(String sourcePath,
String destPath,
String filePattern)
- Compare the source path and the destination path for filenames with the filePattern
e.g. *.bak, *tmp and copy these files to the destination dir if they are not present at the
destination or if they have changed (by modifactionDate)
- Parameters:
destPath - sourcePath - filePattern -
- Returns:
- the number of files being copied
getDirectory
public static List<File> getDirectory(String dirPath,
String filePattern)
- Parameters:
dirPath -
- Returns:
- the ArrayList of file in the directory dirPath matching the filePattern
getDirectory
public static List<File> getDirectory(String dirPath)
getTomcatWebAppPath
public static String getTomcatWebAppPath()
Copyright © 2011. All Rights Reserved.