Keep certain number of characters in folder name

A swapping-ground for Regular Expression syntax

Keep certain number of characters in folder name

Postby beefynerd » Tue Mar 26, 2024 6:38 am

Hello, I have 7600+ folders which need renaming to keep only the first 12 characters. I've searched this forum for an expression to use but frankly it's escaping me. Example:

Original Folder Name: 4x4 Off-Road Photos - Ford Bronco - Desert Highlands - 03252024-1031a
New Folder Name: 4x4 Off-Road

Any suggestions? Thank you!
beefynerd
 
Posts: 2
Joined: Tue Mar 26, 2024 6:18 am

Keep 1st 12-characters

Postby Luuk » Tue Mar 26, 2024 11:24 am

For only folders, can remove the checkmark from "Files" inside of Filters(12).
With Regex(1) could use Match==^(.{12}).* and Replace==\1
With Remove(5) can use From==13 and To==999
Luuk
 
Posts: 699
Joined: Fri Feb 21, 2020 10:58 pm

Re: Keep certain number of characters in folder name

Postby beefynerd » Tue Mar 26, 2024 11:08 pm

Luuk wrote:For only folders, can remove the checkmark from "Files" inside of Filters(12).
With Regex(1) could use Match==^(.{12}).* and Replace==\1
With Remove(5) can use From==13 and To==999


Perfect, this was what I was looking for! Thank you!
beefynerd
 
Posts: 2
Joined: Tue Mar 26, 2024 6:18 am


Return to Regular Expressions