此代码可通过javac编译后直接用java运行
package com.vtradex.stms.server.utils;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class DeleteFilesSimpe {
public static SimpleDateFormat dmy_hms =
new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
public static void main(String[] args) {
String filePath = "D:/app/archivelog";
while(true){
int l = moveFileToReady(filePath);
if(l>0){
System.out.println(dmy_hms.format(
new Date())+","+filePath+"----------"+l);
}else{
System.out.println(dmy_hms.format(
new Date())+","+filePath);
}
try {
//1000=1s,1h=60m,1m=60s,10800000=3h,3600000=1h