1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issue with wildcard directory search

Discussion in 'Programming/Internet' started by flyinggreg, Sep 12, 2018.

  1. flyinggreg

    flyinggreg Guest

    I am running into an issue with trying to validate the existence of a file in a directory utilizing a wildcard.

    The method is supposed to determine if a file with name FAACIFP_(year)(cycle).DAT could be found in the current directory.

    I've tried running a PathMaker.matches("glob:FAACIFP_18") with IF/ELSE and when I tested it, it would always evaluate TRUE. So, I tried a lambda function, and it won't find the file.

    Shouldn't the lambda below print the file name, or am I misunderstanding/misusing it?

    static void getCnvrtdCifpName() throws IOException{
    String cnvFileName = "FAACIFP_"+Year.now()
    .format(DateTimeFormatter.ofPattern("yy"));
    Path cnvFilePath = Paths.get(System.getProperty("user.dir"));
    Files.find(cnvFilePath,0,(path,attr) ->
    path.getFileName().startsWith(cnvFileName)).forEach(System.out::println);
    System.out.println("EVALUATING METHOD....\t SEARCH PATH: "+cnvFilePath
    +" \n\t\t\t FILE STRING: "+cnvFileName);
    }


    Output:

    run:
    Located RAW CIFP file FAACIFP18

    EVALUATING METHOD.... SEARCH PATH: C:\Users\u314170\Documents\Personal\Java\NetBeans\A424Parser
    FILE STRING: FAACIFP_18
    BUILD SUCCESSFUL (total time: 0 seconds)

    Login To add answer/comment
     

Share This Page