cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1205
Views
0
Helpful
2
Replies

How to list files?

steakandeggs
Level 1
Level 1

Does anyone know how to list the files in the customer_folder directory? I'm talking about this one:

System.getProperty("uccx.customer.dir") . I'm having problems casting a variable or object use the java.io.File listFiles method.

2 Replies 2

Ah, yes, I meant how do I list them from the script. I've got premium licensing so java steps are an option. The code below fails on the second java.io.File step where listOfFiles returns an array of file names, but I get an "invalid identifier" on that step when I click the apply button.

{

java.io.File folder = new java.io.File("opt/cisco/uccx/Customer/");
java.io.File[] listOfFiles = folder.listFiles(); 
 
  for (int i = 0; i < listOfFiles.length; i++) 
  {
   if (listOfFiles[i].isFile()) 
   {
   files[i] = listOfFiles[i].getName();

        }

     }

return files;

}

(the script above probably has other issues but I haven't got there yet )