public class BackupManager
extends java.lang.Object
Constructor and Description |
---|
BackupManager(java.io.File backupRoot)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
backupFiles(java.util.Collection<java.io.File> files,
boolean overwrite)
Back up selected files to backup directory.
|
void |
removeOldBackups(int backupsPreserved)
Clean backup directory from old backup subdirs.
|
public BackupManager(java.io.File backupRoot)
backupRoot
- Directory under which the backups will be created and managed.
Not null.public boolean backupFiles(java.util.Collection<java.io.File> files, boolean overwrite) throws java.io.IOException
files
- files to back up. Not null. Non-existent files are ignored.overwrite
- if backup should overwrite already existing subdirectory
(i.e. backup from today)java.io.IOException
public void removeOldBackups(int backupsPreserved) throws java.io.IOException
backupsPreserved
- how many old backups should be preserved. All other
(older) backups will be deleted. Negative integer is converted to 0.java.io.IOException