This script unites these special rename modes: regexp, batch, search/replace, keep characters, set extension. Usage:
- Select some items and run this script.
- Enter rename pattern in whichever mode you want. Usual rules and syntax of individual modes apply.
- Now simply prefix the whole pattern with a single character (case-insensitive) to determine the mode:
r : regexp, b : batch rename, s : search/replace, k : keep characters, e : set extension. - Additionally, to get a preview before the actual rename(s), prefix the whole pattern+modechar with: p
- Examples: batchrename without preview: b*-<date mmyy
> search-&-replace "-" with "_" : ps-/_ regexp rename with preview : r\s\d+.([^.]+)$ > .$1 keep characters with preview: pk&_>- - Assign this script to a quick shortcut via UDC (I myself have assigned CTRL+F2)
- cancelling rename from preview pops up error dialog.
Code: Select all
/*SpecialRename2/SammaySarkar/v1/04-Mar-2015 6:49:40 AMZ/http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=13497*/
$input = input("enter [p for preview] modeswitch char, then pattern<crlf>modes: b,r,s,k,e",
'batch rename without preview: b*-<datem yyyymmdd>'.<crlf>.
'search-&-replace with preview: s /_'
);
$preview = substr($input, 0, 1) == 'p' ? 'p' : '';
$mode = substr($input, $preview ? 1 : 0, 1);
$pattern = substr($input, $preview ? 2 : 1);
//msg $pattern<crlf>$mode<crlf>$preview;
if ($mode LikeI [brske]){
rename $mode, $pattern, $preview, <get selecteditemspathnames |>;
}
XYplorer Beta Club