without extension file names
package com.demo;
import java.io.File;
import java.util.Collection;
public class SampleFile {
public static void main(String[] args) {
File f1 = new File("c:/javasamples");
File[] filelist = f1.listFiles();
for(File list : filelist)
{
//System.out.println("array is "+list.getName().substring(0, list.getName().lastIndexOf('.')));
System.out.println("ar is "+list.getName().substring(0, list.getName().lastIndexOf('.')));
}
}
}
No comments:
Post a Comment