commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@acedsl.com
Subject anomalies using org.apache.commons.io
Date Sun, 14 Aug 2005 18:00:45 GMT
/*
root@0[knoppix]# javac -classpath ./commons-io-1.0.jar:. test00.java
root@0[knoppix]# java -classpath ./commons-io-1.0.jar:. test00
*/

import java.io.*;
import org.apache.commons.io.filefilter.*;

public class test00{
 public static void main(String[] aArgs){
  String[] aDir = new String[]{
   "/"
   ,"."
   ,"/home"
   ,"/home/knoppix"
  };
// __ 
  for(int i=0; i < aDir.length; ++i ){ 
   File dir = new File(aDir[i]);
   if(dir.exists() && dir.isDirectory()){
    System.out.println("// __ Checking: |" + aDir[i] + "|");
    String[] files = dir.list(DirectoryFileFilter.INSTANCE);
    for ( int j=0; j < files.length; ++j ){ System.out.println(files[j]); }
   }// (dir.exists() && dir.isDirectory())
   else{ System.err.println("// __ |" + aDir[i] + "| does not exist or is not a
directory!"); }
  }// i [0, aDir.length)
 }
}

/*
 For some reason it works when you pass "/" and ".", but does not even work when
you use the full path for ".", which is:

root@0[knoppix]# pwd
/ramdisk/home/knoppix

 and even though there are other subdirectories inside of "/home" and
"/home/knoppix", the output on my knoppix box (I have tested it on a hard drive
to) is:

// __ Checking: |/|
bin
boot
cdrom
dev
etc
KNOPPIX
lib
mnt
ramdisk
opt
proc
sbin
home
sys
tmp
usr
UNIONFS
var
root
floppy
initrd
none
// __ Checking: |.|
commons-io-1.0
.mcop
Desktop
.kde
.mozilla
.netscape
.gnome_private
.gnome
.gnupg
tmp
.xine
.qt
.local
.links
.gimp-2.2
.gconfd
.gconf
// __ Checking: |/home|
// __ Checking: |/home/knoppix|
*/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message