• Java


    package com.jyc.autoscanfile;


    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;

    import com.atlife.callout.commons.autoRunThread.runImp.AutoRun;
    import com.atlife.callout.ruleImplement.dto.domain.Cc_action_ruleimplementDto;
    import com.sinosoft.sysframework.reference.DBManager;

    public class AutoScanFile implements AutoRun {

    private AutoScanFile autoScanFile;
    private DBManager dbManager;
    @Override
    public String run(DBManager dbManager,
    Cc_action_ruleimplementDto ccActionRuleimplementDto) {
    try {
    //System.out.println("running----------");
    scanFile(dbManager);
    //System.out.println("running-----2222-----");
    return "success";
    } catch (Exception e) {
    // TODO 自动生成 catch 块
    //e.printStackTrace();
    return "failure";
    }
    }

    //文件扫描
    private void scanFile(DBManager dbManager) {

    List<File> file = autoScanFile.getFiles(new File("F:\Program Files (x86)\test"),"MD5");
    for (File ff : file) {
    System.out.println(ff.getPath());
    System.out.println(ff.getName());
    }
    }



    public List<File> getFiles(File fileDir, String fileType) {
    List<File> lfile = new ArrayList<File>();
    File[] fs = fileDir.listFiles();
    for (File f : fs) {
    if (f.isFile()) {
    if (fileType
    .equals(f.getName().substring(
    f.getName().lastIndexOf(".") + 1,
    f.getName().length())))
    lfile.add(f);
    } else {
    List<File> ftemps = getFiles(f,fileType);
    lfile.addAll(ftemps);
    }
    }
    return lfile;
    }


    public static void main(String[] args) {
    /*AutoScanFile imp = new AutoScanFile();
    DBManager dbManager = new JdbcManager();
    try {
    dbManager.open("platformDataSource");
    imp.run(dbManager, null);
    } catch (Exception ex) {
    ex.printStackTrace();
    } finally {
    try {
    dbManager.close();
    } catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }
    }*/
    }

    }

  • 相关阅读:
    网络嗅探器
    struct udphdr
    struct tcphdr
    struct iphdr
    socket函数
    SQL SERVER-解析Extendevent文件数据
    SQL SERVER-日期按时区转换
    SQL SERVER-CROSS APPLY
    WinServer-文件共享端口
    SQL SERVER-修改实例的排序规则
  • 原文地址:https://www.cnblogs.com/qq3245792286/p/6165684.html
Copyright © 2020-2023  润新知