re: Document Archives/Repositories

Subject: re: Document Archives/Repositories
From: Matthew Horn <mhorn -at- macromedia -dot- com>
To: "TECHWR-L" <techwr-l -at- lists -dot- raycomm -dot- com>
Date: Thu, 12 Sep 2002 09:32:30 -0400

Not sure if this is what you are looking for, but here's the source code of a Java servlet that does what I think you are asking. Just change the directory variable to your dir or add a little form that takes a dir. It includes a link to the file (in the File Name field) so you can open it within a browser.

Sample output:
Full path File Name Readable? Writable? File Type Revision Date File Size
c:\temp\2xl8t.txt 2xl8t.txt true true txt Tue Sep 10 13:41:39 EDT 2002 2015
c:\temp\baby1.jpg baby1.jpg true true jpg Tue Aug 27 17:09:53 EDT 2002 27462
c:\temp\baby2.jpg baby2.jpg true true jpg Tue Aug 27 17:10:43 EDT 2002 27351
c:\temp\baby3.jpg baby3.jpg true false jpg Tue Aug 27 17:12:19 EDT 2002 27255


Matthew J. Horn
Sr. Technical Writer
< m a c r o m e d i a >

- - - - - Code Start Here - - - - -

import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class DirectoryDetails extends HttpServlet {

String directory = "c:/temp";
Date d = new Date();
String fileType;
String fileSize;

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();

File root = new File(directory);
File files[] = root.listFiles();

out.println("<TABLE border=1>");
out.println("<TR><TH>Full path</TH><TH>File Name</TH><TH>Readable?</TH><TH>Writable?</TH><TH>File Type</TH><TH>Revision Date</TH><TH>File Size</TH></TR>");

for (int i=0; i<files.length; i++) {

out.println("<TD>" + files[i].getAbsolutePath() + "</TD>");
out.println("<TD><A HREF=\"" + files[i].getAbsolutePath() + "\">" + files[i].getName() + "</A></TD>");

out.println("<TD>" + files[i].canRead() + "</TD>");
out.println("<TD>" + files[i].canWrite() + "</TD>");

if (files[i].isDirectory()) {
out.println("<TD colspan=3><CENTER>DIR</CENTER></TD>");
else {
out.println("<TD>" + getFileType(files[i].getName()) + "</TD>");
out.println("<TD>" + d + "</TD>");
out.println("<TD>" + files[i].length() + "</TD>");


public String getFileType(String fileName) {
String f = new String();

StringTokenizer st = new StringTokenizer(fileName,".");
while (st.hasMoreTokens()) {
f = st.nextToken();

if (f.equalsIgnoreCase("doc")) {
f = "word doc";
if (f.equalsIgnoreCase("zip")) {
f = "archive";
//... etc

return f;

-----Original Message-----
From: EBoulet -at- Exchange -dot- WebMD -dot- net [mailto:EBoulet -at- Exchange -dot- WebMD -dot- net]
Sent: Wednesday, September 11, 2002 3:46 PM
Subject: Document Archives/Repositories

Do you all know of any tools for creating & maintaining document
repositories or archives on the web? By document repositories, I mean lists
of links to documents in various formats, including Office, Acrobat, Zip,
Executable files, etc. By tools, I mean software programs, scripts, etc that
do things like:

- Generate document lists on a web page automatically, for instance from a
file folder

- Publish document properties with the document in the list, such as
revision date, filesize, filetype - for instance, for an MS Office document,
could you automatically extract the Properties entered for the MS Office
file and show the document properties on a web page?

- Allow users to select a multiple documents to print and then print them
all when a button is selected (rather than printing them one at a time)

I look on the web, but the only useful thing I found is software that will
monitor file folders for new file versions and automatically post them to
your web site.


Check out the new release of RoboDemo, our easy-to-use tutorial software.
Plus, buy RoboHelp Office in August and save $100 with our mail-in rebate.
Get details and download free trial versions at

Acrobat & FrameMaker Seminars: PDF Best Practices, FrameMaker-to-Acrobat
Advanced Techniques, FM Template Design, Single Sourcing with FrameMaker
in Brussels (Oct), and in Montreal & Dallas (Dec):

You are currently subscribed to techwr-l as:
archive -at- raycomm -dot- com
To unsubscribe send a blank email to leave-techwr-l-obscured -at- lists -dot- raycomm -dot- com
Send administrative questions to ejray -at- raycomm -dot- com -dot- Visit for more resources and info.

Previous by Author: RE: seeking localisation advice for hybrid documentation
Next by Author: RE: FW: Interesting article on CBT
Previous by Thread: Document Archives/Repositories
Next by Thread: Re: Document Archives/Repositories

What this post helpful? Share it with friends and colleagues:

Sponsored Ads