RenameFromClipboard - a script command, which renames selected items by fetching text/item-names from the clipboard.
This can be very handy in case you want to rename a bunch of mp3 files, for which you already have a beautyful list of names (from an online source maybe). Another use case is updating a lot of files and folder names from a similar folder containing basically the same but differently named items.
- detects multiline clipboard content and takes care of different line endings (CR vs. CR+LF etc.)
- validates and shapes the clipboard content before it’s used to rename items (not idiotproof yet, so don’t use binary code for renaming o)
- warns you if the number of selected items does not match the number of items in the clipboard
- supports following placeholders to increase flexibility, moving of files is a usecase for that e.g.
[li]%item.realpath%", %item.name%", %item.name_stem%", %item.path%", %item.ext%"[/li]
[li]%item.new_realpath%, %item.new_name%", %item.new_path%, %item.new_ext%"[/li]
[li]The default operation using these is Rename FROM="%item.realpath%" TO="%item.new_name%"[/li][/ul]
- can run multiple commands (default is “Rename” only, edit script config or use COMMANDS param to set additonal params and add commands)
- you can use plain-text directly or files and folders currently in the clipboard (these will be converted by DO to paths and names automatically)
- safemode for testing and watching results on the console
- QUIET (avoid confirmation if number of selected items does not match number of items in clipboard)
- DESELECT (deselect renamed items)
- SAFEMODE (do not run any operation, for testing and previewing actions on the console)
- COMMANDS (any dopus commands to replace/change the default rename operation, use “\n” to separate them here, param must be last)
Crappy filenames in dopus:
Nice file names in editor (copied to clipboard):
Nice file names in DOpus after selecting the crappy mess and running “RenameFromClipboard”:
To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
Create a button or hotkey with the command “RenameFromClipboard” and it’s ready to go with the defaults.
Select and copy text or files/folders from any place. Select the items to rename in dopus and eventually use your new button/menu entry.
Have fun with it, I hope it’s useful for somebody. Bug reports and suggestions are welcome of course! o)
[li]v0.3 / 2015.10.01 - added placeholder %item.new_name_stem%
Command.Item_RenameFromClipboard.js.txt (26 KB)
[li]v0.2.2 - prepared to support updates/scriptwizard:
Command.Item_RenameFromClipboard.js.txt (9.76 KB)
[li]v0.2.1 - performance gain by reusing the command object for all rename operations:
Command.Item_RenameFromClipboard.js.txt (8.87 KB)[/li][/ul]