Solved

Scan local drives for images

Posted on 2007-04-04
2
158 Views
Last Modified: 2010-03-31
Can anyone give me some clues on how to scan local drives for images?
0
Comment
Question by:khoama
2 Comments
 
LVL 11

Accepted Solution

by:
elfe69 earned 500 total points
ID: 18848943
Here is an example of deep directory scanning:
http://www.exampledepot.com/egs/java.io/TraverseTree.html

You could adapt that code to select only the files with the extensions you want
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 18849004
http://www.exampledepot.com/egs/java.io/GetFiles.html


FileFilter fileFilter = new FileFilter() {

      final String[] IMAGE_EXTENSIONS = { ".jpeg", ".jpg", ".png", ".gif" };
      
       
        public boolean accept(File file) {
              boolean isImage = false;
              String name = file.getName().toLowerCase();
              for(int i = 0;i < IMAGE_EXTENSIONS.length && isImage == false;i++) {
              isImage = name.endsWith(IMAGE_EXTENSIONS[i]);
            }
            return isImage;
        }
       
};

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
session migration servlets 2 42
javap bin 2 40
Need help aligning JRadioButton that put in a box using GridBagLayout 2 16
Setup GlassFish 4 21
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question