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