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:
parent
e817ca4689
commit
c5f3a89ed0
@ -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
|
||||
|
@ -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
|
||||
|
19
website/scripts/revert.groovy
Normal file
19
website/scripts/revert.groovy
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user