[Java]±È½ÏÁ½¸öĿ¼µÄÒìͬ£¨Òþ²Ø×ÓĿ¼ÒÔ¸ÄĿ¼ÏµÄÎļþºöÂԱȽϣ©(2)
/** * * @author Phonnie * */ public class DirectoryComparison { public static void compare(String src,String dest) { File srcFile = new File(src); File destFile = new File(dest); List<FileEntity> srcList = new ArrayList<FileEntity>(); List<FileEntity> destList = new ArrayList<FileEntity>(); Map<Integer,List<FileEntity>> map = null; if(!srcFile.exists() || !destFile.exists()) { return; } FileHelper.traversingDir(srcFile, srcList); FileHelper.traversingDir(destFile, destList); FileHelper.setLevels(srcList, src); FileHelper.setLevels(destList, dest); FileHelper.output(srcList); FileHelper.output(destList); map = FileHelper.doCompare(srcList, destList, src, dest); System.out.println("----------------Result:-----------------"); for (Entry<Integer,List<FileEntity>> entry : map.entrySet()) { System.out.println("######## Level:" + entry.getKey() +" ###################\n"); FileHelper.output(entry.getValue()); System.out.println("#######################################"); } } }½ÓÏÂÀ´Ð´¸ö²âÊÔÈë¿Ú³ÌÐò´ò³É¿ÉÒÔÖ´ÐеÄjar°ü£¬Ð´¸öÅú´¦Àí¾Í¿ÉÒÔÖ±½ÓÖ´ÐÐÁË
public class Demo { /** * @param args */ public static void main(String[] args) { if(args==null) { Logger.getLogger(Demo.class.getName()).info("Arguments error!!!"); return; } if(args.length!=2) { for (int i = 0; i < args.length; i++) { System.out.println("arg"+i+":"+args[i]); } Logger.getLogger(Demo.class.getName()).info("args has been too many!!!"); return; } try { DirectoryComparison.compare(args[0], args[1]); } catch (Exception e) { e.printStackTrace(); } } }¸½¼ÓÒ»¸öDateHelper.java
/** * ÀàÃû£ºÈÕÆÚ¸¨ÖúÀà * * @author Phonnie * */ public class DateHelper { /** * ÈÕÖ¾ * */ private static Logger _logger = Logger.getLogger(DateHelper.class.getName()); /** * ½«Ö¸¶¨¸ñʽµÄ×Ö·û´®×ª»¯³ÉÈÕÆÚ * * @param day * ÈÕÆÚ×Ö·û´® * @param format * ¸ñʽ»¯×Ö·û´® * @return ÈÕÆÚ */ public static Date getDate(String date, String format) { Date d = null; SimpleDateFormat df = new SimpleDateFormat(format); try { d = df.parse(date); } catch (Exception e) { _logger.info("Parse string " + date + " to Date failed :" + e.getMessage()); return null; } return d; } /** * ½«ÈÕÆÚת»»³ÉÖ¸¶¨¸ñʽµÄ×Ö·û´® * * @param date * ÈÕÆÚ * @param format * ¸ñʽ»¯×Ö·û´® * @return ¸ñʽ»¯ºóµÄÈÕ×Ó×Ö·û´® */ public static String format(Date date, String format) { String d = null; SimpleDateFormat df = new SimpleDateFormat(format); try { d = df.format(date); } catch (Exception e) { _logger.info("Parse Date " + date + " to String failed :" + e.getMessage()); return null; } return d; } }Åú´¦ÀíÈçÏ£º
@echo off SETLOCAL ENABLEDELAYEDEXPANSION if "%1"=="" ( set /p arg1=ÊäÈëÆðʼ·¾¶: ) else set arg1=%1 if "%2"=="" ( set /p arg2=ÊäÈëÄ¿±ê·¾¶: ) else set arg2=%2 echo ¿ªÊ¼Ö´ÐÐ... java -jar ./bin/dir-util.jar "%arg1%" "%arg2%" pause
ÍƼöÐÅÏ¢
- ÔÝÎ޼Ǽ
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- java urlÖØд¼¼Êõ(UrlReWriter)
- [ת]JavaµÄÊý×飨Array£©¡¢Vector¡¢ArrayLis....
- jsp»·¾³ÏÂajaxÂÒÂëÎÊÌâµÄ½â¾ö
- JSP¼¼Êõ Ö¸Áî ÂÒÂëÎÊÌâ ÔËÐÐÔÀíºÍ¾Å´óÒþʽ¶ÔÏó web¿ª·¢µÄË....
- JAVA ˮӡ ͼƬ ÎÄ×Ö
- java¶þ½øÖÆ£¬ÔÂë¡¢·´Âë¡¢²¹Â롢λÔËËã
- Java WebÓ¦ÓÃÆô¶¯¼ä¸ôÖ´ÐеijÌÐò
- jspÉú³ÉxmlÎļþʾÀý
- javaÖÐÀà±äÁ¿¡¢Àà·½·¨¡¢ÊµÀý±äÁ¿¡¢ÊµÀý·½·¨
- JSPÒ³ÃæµÄÎåÖÖÌøת·½·¨
ÆÀÂÛ