Created
May 20, 2015 23:57
-
-
Save anonymous/d1f5fd1f51d828dc2a3e to your computer and use it in GitHub Desktop.
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
// import de.sciss.file._ | |
val fmtIn = new java.text.SimpleDateFormat("'B'HH'h'mm'm'ss's'ddMMMyyy'.wav'") | |
val fmtOut = new java.text.SimpleDateFormat("yyMMdd_HHmmss'.wav'") | |
def rename(dir: File, prefix: String): Unit = { | |
require(dir.isDirectory) | |
dir.children.foreach { fIn => | |
try { | |
val date = fmtIn.parse(fIn.name) | |
val out = fmtOut.format(date) | |
val fOut = dir / s"$prefix$out" | |
import sys.process._ | |
Seq("mv", fIn.path, fOut.path).! | |
} catch { | |
case _: java.text.ParseException => | |
} | |
} | |
} | |
// rename(userHome/"Documents"/"devel"/"Configuration"/"rec", prefix = "config-") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment