用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - java代码库

实现自动扫描某个文件夹中的图片名称并导入到MediaServer中

2017-03-11 作者: 隆隆0001举报

[java]代码库

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();
        }
 
    }
 
}


网友评论    (发表评论)

共1 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...