2012-11-17 04:14:09 +00:00
|
|
|
// filebot -script fn:revert <file or folder>
|
|
|
|
|
|
|
|
|
|
|
|
def accept(from, to) {
|
|
|
|
args.find{ to.absolutePath.startsWith(it.absolutePath) } && to.exists()
|
|
|
|
}
|
|
|
|
|
|
|
|
def revert(from, to) {
|
|
|
|
def action = net.sourceforge.filebot.StandardRenameAction.forName(_args.action)
|
|
|
|
|
|
|
|
println "[$action] Revert [$from] to [$to]"
|
|
|
|
action.rename(from, to)
|
2013-03-07 14:11:23 +00:00
|
|
|
|
|
|
|
// reset extended attributes
|
|
|
|
tryQuietly{ to.xattr.clear() }
|
2012-11-17 04:14:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getRenameLog(true).reverseEach { from, to ->
|
|
|
|
if (accept(from, to))
|
|
|
|
revert(to, from)
|
|
|
|
}
|