Created
May 31, 2019 18:37
-
-
Save rz7d/ca8d29b2cee5fd4e00b1126cf40c9e4b to your computer and use it in GitHub Desktop.
copies resources of mekanism with renaming to "void" tier name.
This file contains hidden or 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
/* | |
* Copyright (C) 2019 azure. | |
* | |
* "THE SUSHI-WARE LICENSE" | |
* | |
* <[email protected]> wrote this license. | |
* | |
* As long as you retain this notice you can do whatever you want | |
* with this stuff. If we meet some day, and you think this stuff | |
* is worth it, you can buy me a **sushi 🍣** in return. | |
* | |
* (This license is based on ["THE BEER-WARE LICENSE" (Revision 42)]. | |
* Thanks a lot, Poul-Henning Kamp ;) | |
* | |
* ["THE BEER-WARE LICENSE" (Revision 42)]: https://people.freebsd.org/~phk/ | |
*/ | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.nio.file.FileAlreadyExistsException; | |
import java.nio.file.Files; | |
import java.nio.file.Path; | |
import java.nio.file.Paths; | |
public class CopyUltimateTierAsVoid { | |
public static void main(String[] args) throws Exception { | |
var reader = new BufferedReader(new InputStreamReader(System.in)); | |
var src = Paths.get(reader.readLine()); | |
var dest = Paths.get(reader.readLine()); | |
for (Path path : (Iterable<Path>) Files | |
.walk(src) | |
.filter(s -> s.toString().contains("ultimate")) | |
.filter(Files::isRegularFile)::iterator) { | |
var from = path; | |
var to = dest.resolve(src.relativize(from).toString() | |
.replace("ultimate", "void")); | |
var parent = to.getParent(); | |
if (Files.notExists(parent)) | |
try { | |
Files.createDirectories(parent); | |
} catch (FileAlreadyExistsException ignored) {} | |
System.out.println("Copy from " + from + " to " + to); | |
Files.copy(from, to); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment