Package org.mycore.datamodel.niofs.utils
Class MCRDerivateUtil
java.lang.Object
org.mycore.datamodel.niofs.utils.MCRDerivateUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionrenameFiles
(String derivate, String pattern, String replacement) Renames multiple files in one Derivate with the given pattern.static String
testRenameFile
(String filename, String pattern, String replacement) Tests the rename pattern on one file, so you can try the rename befor renaming all files.
-
Constructor Details
-
MCRDerivateUtil
public MCRDerivateUtil()
-
-
Method Details
-
renameFiles
public static Map<String,String> renameFiles(String derivate, String pattern, String replacement) throws IOException Renames multiple files in one Derivate with the given pattern. You can try out your pattern with the methodtestRenameFile
.- Parameters:
derivate
- the Derivate ID as Stringpattern
- the RegEx pattern to find the wanted filesreplacement
- the new name for the files- Returns:
- a Hashmap with the old name and the new name
- Throws:
IOException
-
testRenameFile
Tests the rename pattern on one file, so you can try the rename befor renaming all files. This method does not change any files.- Parameters:
filename
- a filename to try the pattern onpattern
- the RegEx pattern to find the wanted filesreplacement
- the new name for the files- Returns:
- the new filename
-