package cn.cutvideo02; |
/* |
* 功能: |
* 实现自动扫描某个文件夹中的图片名称并导入到MediaServer中 |
* |
*/ |
import java.io.File; |
import java.io.IOException; |
import java.io.UnsupportedEncodingException; |
public class ImportDemo { |
public static void main(String[] args) throws UnsupportedEncodingException { |
// 图片存放的路径 |
String path = "D:\\picDownload" ; |
String ml = null ; |
// String mm=null; |
File rootDir = new File(path); |
String[] fileList = rootDir.list(); |
for ( int i = 0 ; i < fileList.length; i++) { |
path = rootDir.getAbsolutePath() + "\\" + fileList[i]; |
// 截取姓名+身份证号 |
String ss = fileList[i].substring( 0 , fileList[i].indexOf( "." )); |
//截取身份证号 |
String s = fileList[i].substring(fileList[i].indexOf( "+" )+ 1 , fileList[i].indexOf( "." )); |
|
// System.out.println(ss); |
String s1 = new String(java.net.URLEncoder.encode(ss, "utf-8" ).getBytes()); |
|
// 拼接命令并执行 |
ml = " \"http://52.4.1.67:14030/action=TrainFace&database=qlface&numparallel=1&identifier=" + s1 |
+ "&ImagePath=D:/picDownload/" + s1 + ".jpg\"" ; |
curl(ml); |
// 延时1s |
try { |
Thread.sleep( 1000 ); // 延迟 |
} catch (InterruptedException e) { |
e.printStackTrace(); |
} |
} |
} |
// 工具方法,打开curl |
public static void curl(String ml) { |
try { |
String ss = "curl.exe" ; |
System.out.println( "正在为您打开" + ss); |
String exe = "cmd /c D:\\curl\\" + ss + ml; |
System.out.println(exe); |
Runtime.getRuntime().exec(exe); |
} catch (IOException e) { |
e.printStackTrace(); |
} |
} |
} |
初级程序员
by: 丨Z丨 发表于:2017-03-16 11:24:22 顶(0) | 踩(0) 回复
二
回复评论