package com.toolkit.file.encode.frame.filetoUtf8; import java.io.File; import java.io.FilenameFilter; public class GetDirList{ public static void main(final String[] args) { try { String strPath = "D:/ws/bjglweb/WebContent/page/road/equipment/"; File path = new File(strPath); String[] list; if (args.length == 0) list = path.list(); else list = path.list(new FilenameFilter() { public boolean accept(File dir, String n) { String f = new File(n).getName(); return f.indexOf(args[0]) != -1; } }); for (int i = 0; i < list.length; i++) { System.out.println(list[i]); GetContents getcontent = new GetContents(); String contents = getcontent.getContents(strPath + list[i]); CreateUTF8File createUtf8 = new CreateUTF8File(); createUtf8.create(strPath + list[i], contents); System.out.println(list[i] + "––>Utf8 OK!"); } } catch (Exception e) { e.printStackTrace(); } } }