Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Getting Directory File list on Unix Box

Reply
Thread Tools

Getting Directory File list on Unix Box

 
 
TManners
Guest
Posts: n/a
 
      07-21-2004
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");
}
}
 
Reply With Quote
 
 
 
 
Phillip Mills
Guest
Posts: n/a
 
      07-21-2004
In article <(E-Mail Removed) >,
http://www.velocityreviews.com/forums/(E-Mail Removed) (TManners) wrote:

> 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?

--
Phillip Mills
Multi-platform software development
(416) 224-0714
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
div box questions; float text around a box, fit box to image size Gnarlodious HTML 4 05-05-2010 11:30 AM
Re: Getting the list of mount points on a unix like system Roedy Green Java 1 10-30-2008 09:43 PM
System.IO.Directory.GetDirectories() and System.IO.Directory.GetFiles() are not returning the specified directory Nathan Sokalski ASP .Net 2 09-06-2007 03:58 PM
populate one list box with selected values from another list box steven.cooper@infocision.com ASP .Net 1 03-12-2005 11:29 PM
compile C programs with UNIX system calls (= Unix Programs??) jrefactors@hotmail.com C++ 12 01-10-2005 03:35 AM



Advertisments