<folder> in batch rename

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
Post Reply
LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

<folder> in batch rename

Post by LittleBiG »

Code: Select all

v16.70.0003 - 2016-05-05 20:19
    + Batch Rename: Added support for variable <folder>, resolved to each item's 
      parent folder name. For example, this pattern will prefix the item's parent 
      folder name to each renamed item:
        <folder>-*
This doesn't work. I tried the

Code: Select all

rename b, <folder>-*;
and got the very same folder names for all items, not the parent.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: <folder> in batch rename

Post by TheQwerty »

Referencing <folder> like this causes it to be resolved before the call to rename.

This description from the help applies to this scenario as well:
rename() documentation wrote:Note the single quotes around the date variable: This ensures that it is only resolved inside the rename procedure on a per-file basis. If it were double-quoted then all selected files would be appended the modified date of the currently focused item.
This should work as you expect:

Code: Select all

rename 'b', '<folder>-*';

LittleBiG
Posts: 1848
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: <folder> in batch rename

Post by LittleBiG »

Thanks, indeed! (how sloppy reader I was...)

Post Reply