php 档案挂接,档案系统文件挂接简单处理思路

档案系统文件挂接

拷贝文件到 FTP 服务器上

批量获取文件信息

分析表关系,插值

总结

拷贝文件到 FTP 服务器上

假设文件保存路径为 D:\档案文件\

批量获取文件信息

提取文件信息保存到txt中.bat

@ECHO OFF

dir D:\档案文件\*.pdf /s/b | find "[部分匹配内容]" > fileinfo.txt

参数描述 (具体描述可以在命令行中使用 help dir)

/s : 显示指定目录和所有子目录中的文件

/b : 不显示标题等信息

分析表关系,插值

分析存储文件相关的表关系

读 txt 文件,按行进行处理

// 编码方式,根据实际需要进行更改

private static final String ENCODING = "GB18030";

/**

* 获取文件的行

*

* @param fileName 文件名称

* @return void

*/

public static void getContentByLine(String fileName) {

InputStreamReader read = null;

BufferedReader bufferedReader = null;

try {

String configPath = new File(fileName).getPath();

File file = new File(configPath);

// 判断文件是否存在

if (file.isFile() && file.exists()) {

read = new InputStreamReader(new FileInputStream(file), ENCODING);

bufferedReader = new BufferedReader(read);

String lineTxt;

while ((lineTxt = bufferedReader.readLine()) != null) {

try {

if (lineTxt.length() == 0) {

continue;

}

/**

* TODO 获取到行,进行处理

*/

} catch (Exception e) {

// TODO 出错了,跳过当前行,并记录错误信息

e.printStackTrace();

continue;

}

}

}

} catch (Exception e) {

e.printStackTrace();

} finally {

try {

if (read != null) {

read.close();

}

} catch (IOException e) {

e.printStackTrace();

} finally {

if (bufferedReader != null) {

try {

bufferedReader.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

}

}

总结

文件量多的话,会生成比较大的 txt 文件,导致打开的时候很慢。推荐使用 TXTkiller 进行分割,然后可以考虑使用多线程处理。有更好的处理思路欢迎评论。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值