How to get tags in batch rename?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
minikyu
Posts: 4
Joined: 06 May 2023 09:32

How to get tags in batch rename?

Post by minikyu »

I want to add tags to my filenames in batch, because not all computers have xyplorer. So can I get the tags of the files from a script in "special rename -> batch rename "? Something like <date yyyy-mm-dd>, just use <tag>.

highend
Posts: 14639
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: How to get tags in batch rename?

Post by highend »

No, that variable isn't supported in that context.

You would need to loop over all selected items, read the tags and rename the item with that info...

E.g.:

Code: Select all

    // Rename items by adding their tags
    setting "BackgroundFileOps", 0;
    foreach($item, <get SelectedItemsPathNames>, <crlf>, "e") {
        $base = gpc($item, "base");
        $ext  = gpc($item, "ext");
        $tags = tagitems("tags", , $item);
        if ($tags) {
            $tags = regexreplace($tags, "(<|>|:|""|/|\\|\||\?|\*)", "_");
            $name = $base . " - " . $tags;
            if (exists($item) == 1) { $name .= "." . $ext; }
            renameitem($name, $item);
        }
    }
One of my scripts helped you out? Please donate via Paypal

Post Reply