1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-11 03:45:06 -05:00

+ added a cmdline script for reverting previously renamed files

This commit is contained in:
Reinhard Pointner 2012-11-17 04:14:09 +00:00
parent e817ca4689
commit c5f3a89ed0
3 changed files with 35 additions and 1 deletions

View File

@ -78,6 +78,20 @@ public enum StandardRenameAction implements RenameAction {
}
},
RENAME {
@Override
public File rename(File from, File to) throws IOException {
// rename only the filename
File dest = new File(from.getParentFile(), to.getName());
if (!from.renameTo(dest))
throw new IOException("Rename failed: " + dest);
return dest;
}
},
TEST {
@Override

View File

@ -29,6 +29,7 @@
^Downloads$
^DVD
^Erotic$
^Extract$
^Film[s]?
^Finished
^Horror$
@ -72,8 +73,8 @@ Demonoid
Director's.Cut
Directors.Cut
Discovery.Channel
DLLValley.eu
DLLValley
DLLValley.eu
docu
Dual.Audio
dubbed

View File

@ -0,0 +1,19 @@
// 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)
}
getRenameLog(true).reverseEach { from, to ->
if (accept(from, to))
revert(to, from)
}