Solved

Scan local drives for images

Posted on 2007-04-04
2
162 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SHA2 certs for IIS AND Java? 2 136
junit example issue 2 59
Strange router problem - can't access hotmail.com 14 109
listing all the respondents to a twitter feed - Java 5 49
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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 …
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Suggested Courses

752 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