Solved

Scan local drives for images

Posted on 2007-04-04
2
154 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
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…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now