Getting Directory File list on Unix Box

T

TManners

Again a newbie to JSP.

Here is my dilema:
I have a jsp page that when it loads I need it to read the names of
the files located in a directory on the UNIX web server that hosts the
page. The directory is /u004/qms/ext_tables. Once it knows the names
of the files I need to pass the names of those files to a Oracle
Stored Procedure.

I got the following code to work; however, it was on a Windows box
with a mapped drive to the folder containing the file names I needed
(o:\) When moved off the test box (WINNT) to the production box
(UNIX), the code crashed. I need to modify the following to work with
UNIX. CAN someone plesae help!!!

String sSPName = "ImportNOCCData";
class TxtDocFilter implements FileFilter {
public boolean accept(File f) {
String name = f.getName().toLowerCase();
return name.endsWith(".txt");
}
}
File f = new File("o:/");
File[] files = f.listFiles(new TxtDocFilter());
int counter;
for (counter=0; counter<files.length; counter++)
{
String s = ""+ files[counter] +"";
String CleanPath = s.replaceAll("o:\\\\","");
int iUserID = ((Integer)session.getAttribute("userid")).intValue();;
// call the SP
CallableStatement oCs = oCn.prepareCall("{CALL " + sSPName + "(?, ?,
?, ?)}");
oCs.setString(1, CleanPath);
oCs.setString(2, "07/20/2004");
oCs.setInt(3, iUserID);
oCs.registerOutParameter(4, java.sql.Types.INTEGER);
oCs.setInt(4, 0);
oCs.execute();
int iRetVal=oCs.getInt(4);
if (iRetVal>0)
{
//out.print(iRetVal);
out.print("Import failed. Please contact System Administrator with
a system code of ");
out.print(iRetVal);
}
else
{
response.sendRedirect("main.jsp?importsuccess=1");
}
}
 
P

Phillip Mills

When moved off the test box (WINNT) to the production box
(UNIX), the code crashed. I need to modify the following to work with
UNIX.

What code did you change for UNIX? (File("o:/") at least, I assume?)

Where did it crash?

What message did you get from the crash?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top