📄 scantongda.java
字号:
package net.aetherial.gis.test.tools.scanBianma;
import java.io.File;
import net.aetherial.gis.surface.CreateFile;
/**
* <p>Title: </p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2004</p>
*
* <p>Company: </p>
*
* @author not attributable
* @version 1.0
*/
public class ScanTongda {
private String inputPath = "";
private String outputPath = "";
public ScanTongda() {
}
public void setInputPath(String inputPath) {
this.inputPath = inputPath;
}
public void setOutputPath(String outputPath) {
this.outputPath = outputPath;
}
public void createString(){
String n = this.createShi();
this.createFile(new File(this.getSplashPath(this.outputPath) + "市县名称.txt"),n);
}
private String getSplashPath(String path){
if (path.endsWith("\\")) {
return path;
}
else if (path.endsWith("/")) {
return path;
}
else {
return path + "\\";
}
}
private String createShi() {
String n = "";
File[] shis = this.getShiFiles();
File[] xians = null;
for (int i = 0; shis != null && i < shis.length; i++) {
if (isRightFile(shis[i])) {
// n += "\r\n";
xians = shis[i].listFiles();
for (int j = 0; j < xians.length; j++) {
if (isRightFile(xians[j])) {
// n += getARecord(shis[i], xians[j]) + "\r\n\r\n";
n += shis[i].getName() + "\t" + xians[j].getName() +"\r\n";
}
}
// this.createFile(new File(getSplash(outputPath) + shis[i].getName() +
// "_" + this.fileAddname + ".bat"),
// n);
}
}
return n;
}
private void createFile(File file, String content) {
CreateFile cf = new CreateFile(file);
cf.setEncode("GB2312");
cf.memoryToFile(content);
System.out.println(file.getAbsolutePath());
}
private boolean isRightFile(File file) {
if (file.getName().indexOf("汇总") != -1 ||
file.getName().indexOf("svn") != -1) {
return false;
}
else {
return true;
}
}
private File[] getShiFiles() {
File anhuisheng = new File(inputPath);
return anhuisheng.listFiles();
}
public static void main(String args[]){
ScanTongda st = new ScanTongda();
st.setInputPath("E:\\农村公路通达情况调查\\数据\\报部数据\\安徽省");
st.setOutputPath("E:\\test\\10");
st.createString();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -