Hy,
i'm new in the xyplorer community and i have already my first problem:
I have a load of files wich are named like abcd_1.pdf, efgh_2.pdf, ijkl_3.pdf and so on but i need them to be like abcd_001.pdf, efgh_002.pdf, ijkl_003.pdf,......
Is there a quick way to do that?
thanks in advance
rename files
Re: rename files
Only doable via scripting (as long as the number part can be greater than 9)...
Select all those items and execute this:
Select all those items and execute this:
Code: Select all
$items = <get SelectedItemsPathNames>;
end (!$items), "No item(s) selected, aborted!";
$src = "";
$dst = "";
foreach($item, $items, <crlf>, "e") {
if (exists($item) == 2) { continue; }
$base = gpc($item, "base");
$ext = gpc($item, "ext");
$match = trim(regexmatches($base, "_\d+?$"), "_", "L");
if ($match) {
$src .= $item . <crlf>;
$base = regexreplace($base, "^(.+?)_(\d+?)$", "$1");
$dst .= $base . "_" . format($match, "000") . ".$ext" . <crlf>;
}
}
if ($dst) {
rename "l", trim($dst, <crlf>), "p", trim($src, <crlf>), 64;
}
One of my scripts helped you out? Please donate via Paypal