#1 : 27/04-22 19:43 Nome
Posts: 3
|
I read the manual and the forums but still cannot figure. Basically I want Word tag that counts from backwards.
I want this: Random file name.jpg.bc 2022-04-26 184124 to become this: Random file name.jpg.bc 2022-04-26 184124.jpg The length of name after "Random file name" remains same. I want the extension name in the mid of filename (.jpg in this case) to be also added at the end. I could almost do it with Add method by adding at index 1 from backwards. But in the Add box, I was going to use Word tag but word tag does not count from backwards. Length of filename before .jpg varies but after .jpg remains constant (.bc yyyy-mm-dd hhmmss) so I can use this fact. |
#2 : 27/04-22 23:04 David Lee
Posts: 1125
|
This will work if we can assume that there is no dot in the filename before the embedded extension and that this extension is always followed by another dot (ie .jpg. in this example)...
Replace: [^.]*(\.[^.]*)\..*\K with: \1 Use regular expressions Apply to: Name and extension |
#3 : 28/04-22 08:21 Nome
Posts: 3
|
Reply to #2:
Indeed that will be true mostly. But can you yell me with example that what if there is a period elsewhere in filename before embedded extension? So that I can prepare myself for the wrongly renamed files. |
#4 : 28/04-22 08:21 David Lee
Posts: 1125
|
Reply to #2:
Alternatively, since the embedded extension is always followed by 21 characters: Replace: (\..*).{21}$\K with: \1 Use regular expressions Apply to: Name and extension |
#5 : 28/04-22 08:43 David Lee
Posts: 1125
|
Reply to #4:
A simpler solution is: Add: .<RSubstr:1:.> At index: 0 Backwards Apply to: Name and extension |
#6 : 28/04-22 18:33 Nome
Posts: 3
|
Reply to #4:
You are awesome. One more issue: some files give error "Filename too long" because of name's length. How do I get around that? |
#7 : 28/04-22 18:54 David Lee
Posts: 1125
|
Reply to #6:
You are probably exceeding Windows MAX_PATH limit of 260 characters for the total file path. You can fix this by simplifying your directory structure. This limitation has been removed in recent versions of Windows 10 but you have to opt-in by enabling the LongPathsEnabled key in the system registry using regedit: The registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled must exist and be set to 1 (Type: REG_DWORD). A reboot might be required because some processes may have started before the key was set. See https://docs.microsoft.com/en-us/windows/win32/f ileio/maximum-file-path-limitation for further details. EDIT: Make sure you are using the latest 64 bit version of Advanced Renamer. Kim updated support for long path names in ver 3.88 (20th July 2021). However not all parts of the program will work with long paths. See version log: https://www.advancedrenamer.com/versionlog |