Sort the file according to type and making folder coderinme

package Calculation;
import java.io.*;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.nio.file.attribute.PosixFileAttributes;
import java.text.*;
import java.util.*;

public class type {
public type(){}
public void clean(String url)
{
File p= new File(url);
for(File file: p.listFiles())
{ for (File f : file.listFiles())
f.delete();
file.delete();
}
}

public String getType(File path) throws IOException
{
StringTokenizer n= new StringTokenizer(path.getName(),”.”);
String file_name= n.nextToken();
String type= n.nextToken();
return type;

}

private static void copyFile(File source, File dest)
throws IOException {
Files.copy(source.toPath(), dest.toPath());
System.out.println(“success”);
}

//main
@SuppressWarnings(“unchecked”)
public static void main(String [] args)throws IOException, ParseException{
type ne=new type();

final String url =”inpsrc\\type\\”;
File directory = new File(“outsrc\\date_check”);
int n= directory.listFiles().length;
File [] myarray;
ne.clean(url);

//myarray=new File[n];
myarray=directory.listFiles();
List datecollect= new ArrayList();
Set uniqueEntries = new HashSet();
for(int i=0;i

Leave a reply:

Your email address will not be published.