Last active
May 2, 2017 08:07
-
-
Save ahmetaa/412cdec3301df9bf7518167d864943c5 to your computer and use it in GitHub Desktop.
copy stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CopyStuff { | |
public static void main(String[] args) throws IOException { | |
Path sourceRoot = Paths.get("/home/aaaa/prototip/exec"); // normalde kullanılan dosyalar bu exec dizininde | |
Path kaldiSrcRoot = Paths.get("/home/aaaa/apps/kaldi/src"); // kaldi src dizini yolu. | |
Path targetRoot = Paths.get("/home/aaaa/prototip/exec-new"); // yeni dosyaların kaydedileceği dizin. | |
// dosya isimlerini topla. | |
Set<String> paths = Files.walk(sourceRoot) | |
.filter(s -> s.toFile().isFile()) | |
.map(s -> s.toFile().getName()) | |
.collect(Collectors.toSet()); | |
// kaldi src içerisinde yürü ve aynı isme sahip dosyaları bul. | |
List<Path> result = Files.walk(kaldiSrcRoot, 2) | |
.filter(s -> s.toFile().isFile() && paths.contains(s.toFile().getName())) | |
.collect(Collectors.toList()); | |
// bunları hedefe kaydet. | |
Files.createDirectories(targetRoot); | |
for (Path path : result) { | |
Files.copy(path, targetRoot.resolve(path.getFileName())); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment