Scan folder pgm
package com.demo;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.apache.commons.io.FileUtils;
public class ScanFolder {
private static List<File> filelist = new ArrayList<File>();
public static void main(String[] args) {
File root = new File("c:/javasamples");
while (true) {
Collection<File> files = FileUtils.listFiles(root,
new String[] {".vob"}, true);
//System.out.println("filelist");
for (File fileslist : files)
{
System.out.println("controal reached");
System.out.println("controal reached fileslist"+fileslist);
if (!filelist.contains(fileslist))
{
System.out.println("controal reached if block");
filelist.add(fileslist);
System.out.println("file added "+fileslist.getName());
}
}
}
}
}
No comments:
Post a Comment