long lastModified = file.lastModified();SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");Date now = sf.parse(DateUtils.formatDate(new Date(),"yyyy-MM-dd"));Date fileDate = new Date(lastModified);//假如该文件是今天以前的文件,则删除该文件if(now.after(fileDate){ //TODO删除前台的文件}