10624050bbdbfa673e4a2d5bdf70ad2f91f8bc60.svn-base 974 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.toolkit.file.encode.frame.filetoUtf8;
  2. import java.io.File;
  3. import java.io.FilenameFilter;
  4. public class GetDirList{
  5. public static void main(final String[] args) {
  6. try {
  7. String strPath = "D:/ws/bjglweb/WebContent/page/road/equipment/";
  8. File path = new File(strPath);
  9. String[] list;
  10. if (args.length == 0)
  11. list = path.list();
  12. else
  13. list = path.list(new FilenameFilter() {
  14. public boolean accept(File dir, String n) {
  15. String f = new File(n).getName();
  16. return f.indexOf(args[0]) != -1;
  17. }
  18. });
  19. for (int i = 0; i < list.length; i++) {
  20. System.out.println(list[i]);
  21. GetContents getcontent = new GetContents();
  22. String contents = getcontent.getContents(strPath + list[i]);
  23. CreateUTF8File createUtf8 = new CreateUTF8File();
  24. createUtf8.create(strPath + list[i], contents);
  25. System.out.println(list[i] + "––>Utf8 OK!");
  26. }
  27. } catch (Exception e) {
  28. e.printStackTrace();
  29. }
  30. }
  31. }