Advanced renaming syntax

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

Advanced renaming syntax

#1 Post by CabbageTree » 01.10.2019, 10: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: 6115
Joined: 19.08.2007, 23:40

Re: Advanced renaming syntax

#2 Post by Dreamer » 05.10.2019, 17: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: 370
Joined: 18.10.2015, 16:44

Re: Advanced renaming syntax

#3 Post by stephen147 » 07.10.2019, 19: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: 97
Joined: 29.09.2009, 17:15

Re: Advanced renaming syntax

#4 Post by CabbageTree » 18.10.2019, 16:10

Wow!

Thank you both guys!

Marek
Author
Author
Posts: 3976
Joined: 10.04.2006, 09:48
Location: Germany
Contact:

Re: Advanced renaming syntax

#5 Post by Marek » 04.11.2019, 17: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: 6115
Joined: 19.08.2007, 23:40

Re: Advanced renaming syntax

#6 Post by Dreamer » 05.11.2019, 00: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 42 guests