java远程创建⽂件夹_java-如何从Linux删除远程Windows中的
⽂件夹
实现此⽬的的另⼀种⽅法可能是直接从Web服务器执⾏此操作,⽅法是向您的⽹站添加⼀种清理资源的⽅法.
然后,只需使⽤Java删除⽂件夹:
linux怎么读取windows文件// You could pass a parameter to the URL to know if it's windows
// or linux and set the path accordingly
String path = "c:/temp";
Path directory = (path);
Files.walkFileTree(directory, new SimpleFileVisitor() {
@Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) throws IOException {
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
最后,使⽤Selenium,只需在完成测试后导航⾄该URL.
<("your_server/clean_resources");