<Solved>Script batch rename problem
Posted: 11 May 2022 14:06
Get part of the filename from the selected item in another pane, and use it to compose the new list of filenames to rename files in the current pane:
The last separator becomes a path, see attachments. If I use replace() to replace it, I will get "Error 14, Out of string space" when the filename is long.
listfolder() gets a list with no separator at the end, but cannot get a manually sorted list.
Code: Select all
$SelectedItem = get("Item", i);
$ItemName = regexreplace("$SelectedItem", "(.*\\)(.*0530)(.*)(.....*)", "$2");
//$List = listfolder(, , , <crlf>);
//$List = formatlist($List, s, <crlf>);
$List = report("{fullname}<crlf>",0);
$P = "0";
$RenamePreview = "";
foreach($Item, $List, "<crlf>") {
$RenamePreview .= $ItemName . _ . $P<crlf>;
$P = $P+1;
}
rename l, $RenamePreview, p, $List;