| | |
| | | InputStream ins = socket.getInputStream();
|
| | | ZipInputStream zis=new ZipInputStream(ins);
|
| | |
|
| | | String rootDir=null;
|
| | | String rootDir="REGULAR_BACKUP";
|
| | | //在此次连接中,是否是第一次读到ZipEntry.读到的第一个Entry,就是正在被传输的文件夹。
|
| | | boolean isFirst=true;
|
| | | String savePath="D:"+File.separator+MYSQLBACKUPDIR+File.separator;
|
| | |
| | | while( (ze=zis.getNextEntry())!=null )
|
| | | {
|
| | | String name=ze.getName();
|
| | | System.out.println(name);
|
| | | File file=null;
|
| | | if(ze.isDirectory())
|
| | | {
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | int index=name.indexOf(rootDir);
|
| | | int index;
|
| | | if(isFirst) {
|
| | | index = name.lastIndexOf("\\");
|
| | | }else { |
| | | index=name.indexOf(rootDir);
|
| | | }
|
| | | String tempFileDir=name.substring(index,name.length());
|
| | | file=new File(savePath+tempFileDir);
|
| | | fos=new FileOutputStream(file);
|