imario 2004/05/27 13:06:56 Modified: vfs/src/java/org/apache/commons/vfs/example ShowProperties.java Log: show the first 5 children-names of an folder Revision Changes Path 1.4 +11 -2 jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/example/ShowProperties.java Index: ShowProperties.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs/example/ShowProperties.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ShowProperties.java 26 May 2004 08:22:07 -0000 1.3 +++ ShowProperties.java 27 May 2004 20:06:56 -0000 1.4 @@ -72,7 +72,16 @@ } else if (file.getType().equals(FileType.FOLDER) && file.isReadable()) { - System.out.println("Directory with " + file.getChildren().length + " files"); + FileObject[] children = file.getChildren(); + System.out.println("Directory with " + children.length + " files"); + for (int iterChildren = 0; iterChildren < children.length; iterChildren++) + { + System.out.println("#" + iterChildren + ": " + children[iterChildren].getName()); + if (iterChildren > 5) + { + break; + } + } } System.out.println("Last modified: " + DateFormat.getInstance().format(new Date(file.getContent().getLastModifiedTime()))); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]