public class RecoverPictures {
public static void main(String[] args) {
recover();
}
public static void recover() {
String listPic = "qrsctl-v3.2.20170501 listprefix pictures \"\" ";
String downloadPic = "qrsctl-v3.2.20170501 get pictures ";
String picPath = "D:\\Tools\\picc";
Runtime runtime = Runtime.getRuntime();
int i = 0;
try {
String[] command = {"cmd", "/c", listPic};
Process process = runtime.exec(command, null, new File("D:\\Tools"));
InputStream in = process.getInputStream();
InputStreamReader isr = new InputStreamReader(in);
BufferedReader buffer = new BufferedReader(isr);
String line = null;
while( (line = buffer.readLine()) != null ) {
if("marker: ".equals(line)) {continue;}
i++;
System.out.println(line);
String downloadCmd = downloadPic + line + " " + picPath + "\\" + line;
String[] command2 = {"cmd", "/c", downloadCmd};
runtime.exec(command2, null, new File("D:\\Tools"));
Thread.sleep(1000);
}
System.out.println("共下载图片总数:" + i );
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}