package com.leanwo.activiti.db;

import java.io.IOException;

import javax.inject.Named;

@Named
public class ClearBackupServiceImpl implements ClearBackupService {
	public void clear(String backupsFilesPath, int backupsFilesLife) {
		String cmd = "forfiles /p " + backupsFilesPath + " /m * /d -" + backupsFilesLife + " /c \"cmd /c del @file\" ";
		try {
			Process ps = Runtime.getRuntime().exec(cmd);
			ps.waitFor();
		} catch (IOException ioe) {
			ioe.printStackTrace();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
}
