Expand my Community achievements bar.

FileUtilsService Find method always return empty list! bug or config error?

Avatar

Level 2

Dear all,

I am trying to use the FileUtilsService Find method to return a list of file in a folder.

For some reasons, it always returns empty list.

Here is the config that I am using:

Input

Directory: "c:\temp"

Regular Expression: "*"

Match Directories: "true"

Match Files: "false"

Output

Results: list

Thanks,

Paul

4 Replies

Avatar

Former Community Member

I have duplicated the issue on my machine .....so I am looking into it. You do have a couple of issues though. The Regular Expression you have indicated is not a valid Reg Expression and accordingn to the help the output list needs to be a subtype of strings. Even with these changes I am still getiing an empty list. Can you try it on your system and validate?

Thanks

Paul

Avatar

Level 2

I have tried with all kind of reg expressions and I still get the same empty list result.

yes, the list subtype is a string type.

Thanks for looking into this issue,

Paul

Avatar

Former Community Member

Just got mine to work ...here are my settings:

Directory: "c:\temp\"

Regular Expression: ".*"

Match Directories: "true"

Match Files: "true"

Output

Results: list of strings

Note that the directory must have a slash a the end.

Paul

Avatar

Level 2

Still not working. I write a simple script to do it.

Thanks,

Paul

import java.io.File;
import java.lang.String;
import java.util.Arrays;
import java.util.List;

File folder = new File("D:\\temp");
File[] listOfFiles = folder.listFiles();

String [] files = new String[listOfFiles.length];

for (int i = 0; i < listOfFiles.length; i++)
{
      if (listOfFiles[i].isFile())
  {
  files[i] = listOfFiles[i].getName();
}
}


List lstFile  = Arrays.asList(files);

patExecContext.setProcessDataListValue("/process_data/javaArray",lstFile);