I'm trying to rename selected files with spaces (ie: "DATE_DAY at M-DD TIME") with underscores.
Using
Code: Select all
$items = <get SelectedItemsNames>;
end (!$items), "No item(s) selected, aborted!";
$items = recase($items);
$items = regexreplace($items, "( |-|_)+", "_");
$new = "";
foreach($item, $items, <crlf>, "e") {
$new .= regexreplace(gpc($item, "base"), "[^a-z0-9-]+", , 1) . "." . gpc($item, "ext") . <crlf>;
}
$new = trim($new, <crlf>, "R");
if ($new != $items) {
rename "l", $new, "p", , 64;
}Also if it's possible to generate a txt file stating what changed in the directory with original file format and new file formate time and date within the file?Missing Seperator " > " between RegExpPattern and ReplaceWith!
XYplorer Beta Club