Solved

Scan local drives for images

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Message handling in Service Layer 3 58
Image decoding from Camera 3 72
Java / Linux and Regular Expressions 11 71
eclipse java  build path 6 45
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

895 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

15 Experts available now in Live!

Get 1:1 Help Now