Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

How to list files?

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
VIP Super Bronze
New Member

Re: How to list files?

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 )

150
Views
0
Helpful
2
Replies