Thanks good point. Like I said this is good practice for me and its good to get the feed back. I have added to the code above but am getting an expected identifier message in my
IDE ( which
is visual J++)
Am I on the right track
import java.io.*;
import java.util.*;
public class
Test {
public static void main(
String a[] )
{
File file = new File( "c:\\windows\\desktop\\" );
File[] files = file.listFiles(); // use listFiles(filter) if you need
File[] jpgfiles = file.listFiles
(new FilenameFilter(){
for(int i = 0;i<files.length();i++) {
accept(file,files[i].getName()){
StringTokenizer st1 =new StringTokenizer (files[i].getName(),".")
String tok1 = st1.nextToken();
String tok2 = st1.nextToken();
if(tok2.equals("jpg")
return true;
else
return false;
}
}
});
for( int i = 0; i < files.length; i++ )
{
if( !files[i].isDirectory() )
System.out.println( "File : "+files[i].getName() );
// instead of above do files[i].rename("string");
}
}
}