package getname;
/*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
| \_| ''\---/'' | |
\ .-\__ `-` ___/-. /
___`. .' /--.--\ `. . __
."" '< `.___\_<|>_/___.' >'"".
| | : `- \`.;`\ _ /`;.`/ - ` : | |
\ \ `-. \_ __\ /__ _/ .-` / /
======`-.____`-.___\_____/___.-`____.-'======
`=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
佛祖保佑 永无BUG
*/
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class secondAdapt {
public static void main(String[] args) throws IOException {
getName();
class sleep1 implements Runnable {
public void run() {
System.out.println("文件名复制中,请在三秒后输入复制数量");
int time = 3;
while(time>0) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("请等待"+time--+"秒");
}
}
}
sleep1 ss = new sleep1();
new Thread(ss).start();
Scanner sc = new Scanner(System.in);
writerFile(sc.nextInt());
sc.close();
}
public static void writerFile(int ws) throws IOException {
FileReader fin=new FileReader(new File("D:\\myDoc\\2bmd.txt"));
BufferedReader reader=new BufferedReader(fin);
FileReader finn=new FileReader(new File("D:\\wx\\wxmd.txt"));
BufferedReader vxmm=new BufferedReader(finn);
String mm;
String gg=null;
String m;
String towClassName=null;
for(int i= 0;i<ws;i++) {
while((mm=vxmm.readLine())!=null){
gg=mm;
break;
}
while((m=reader.readLine())!=null){
towClassName=m;
break;
}
String fileName = "D:\\myDoc2\\"+( 2003040201+ i)+ towClassName+".jpg";
String sfile= "D:\\wxzp\\";
FileInputStream fs = new FileInputStream(sfile +gg);
FileOutputStream os = new FileOutputStream(fileName);
byte[] bytes = new byte[1024];
int len = 0;
while ((len= fs.read(bytes)) != -1) {
os.write(bytes, 0, len);
}
os.close();
fs.close();
}
fin.close();
reader.close();
finn.close();
vxmm.close();
System.out.print("复制成功");
}
public static void getName() throws IOException {
String path = "D:\\wxzp";//文件位置
File f = new File(path);
FileWriter fisn = new FileWriter("D:\\wx\\wxmd.txt");//文件导出地址
File fa[] = f.listFiles();//将文件名存入fa[]
for (int i = 0; i < fa.length; i++) {
File fs =fa[i];
fisn.write(fs.getName()+"\r\n");
}
System.out.println("文件名复制成功。");
fisn.close();
}
}
这是我第一个写的小东西,是对于我生活中有帮助的
收同学交的一些图片,hi没有太完善
嘿嘿
继续加油哈哈