package makeDirectory;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import javax.imageio.IIOException;
public class Main {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String path="C:\\test\\";
for(int i=1;i<20000;i++)
{
File f=new File(path+i+".txt");
f.createNewFile();
FileOutputStream fou=new FileOutputStream(f);
OutputStreamWriter ou=new OutputStreamWriter(fou, "UTF-8");
ou.write("中"+i);
ou.flush();
ou.close();
}
System.out.println("ok");
}
}
java创建20000个txt
于 2022-11-06 00:08:38 首次发布