Advanced renaming syntax

Discussion and questions - donor version.
Post Reply
Message
Author
CabbageTree
Posts: 53
Joined: 29.09.2009, 15:15

Advanced renaming syntax

#1 Post by CabbageTree » 01.10.2019, 08:03

Hi there,

I wonder, whether is there a way how to automatically put a zero in front of single digit in the end of the file. When I have file named like this:
  • File_1.png
  • File_2.png
  • File_3.png
  • File_4.png
  • File_10.png
  • File_11.png
  • File_12.png
When I want the file to be numbered by two digits, I have to manually pick the 1—9 and rename them by search & replace. This works, but feels kind of manual. I also cannot just renumber the files automatically from scratch, because they cannot be sorted appropriately either by name or time.

Is there some advanced syntax for this, even if the length of the filename is variable, but the numbers are the last?

Thanks for any ideas…

User avatar
Dreamer
Site Admin
Posts: 4055
Joined: 19.08.2007, 21:40

Re: Advanced renaming syntax

#2 Post by Dreamer » 05.10.2019, 15:26

If you have the same number of non-digit characters, it's possible, if not, it would be harder, or impossible, but it would be easier with exact example.

You can use Natural sorting option to sort such files in correct order.

Anyway, I think this could be quite useful feature, I will start a new topic.

stephen147
Posts: 266
Joined: 18.10.2015, 14:44

Re: Advanced renaming syntax

#3 Post by stephen147 » 07.10.2019, 17:49

If you're looking for a regular expression to use in the rename dialog use something like this:

Replace:
(?!0)(\d)(?!\d)$

Replace with:
0$1

Tick the exclude extension checkbox.

Full explanation here: https://regex101.com/r/k2CCDD/1

Just save it as a preset and Bobs your uncle.
Sceenshots made easy with ShareX.

CabbageTree
Posts: 53
Joined: 29.09.2009, 15:15

Re: Advanced renaming syntax

#4 Post by CabbageTree » 18.10.2019, 14:10

Wow!

Thank you both guys!

Marek
Author
Author
Posts: 2836
Joined: 10.04.2006, 07:48
Location: Germany
Contact:

Re: Advanced renaming syntax

#5 Post by Marek » 04.11.2019, 16:55

In the last release 806, if you want replace any number at the end of the file name, you can use:
Search for: [0-9]+\Z
Replace with: [c]
"Regular expression" - active
"Exclude extension" - active

User avatar
Dreamer
Site Admin
Posts: 4055
Joined: 19.08.2007, 21:40

Re: Advanced renaming syntax

#6 Post by Dreamer » 04.11.2019, 23:14

Thanks, Marek, it will be just not easy to find.

Added to "FreeCommander XE "not so obvious" settings" topic.

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests