Bug: subsrt on directories

Advanced Renamer forum
#1 : 19/01-24 01:47
Jufy111
Posts: 2
I think I found a bug with the substr tag function

When using the move batch mode on directories, I was trying to generate parent directories using the substr function. (i.e D:\test\<substr:7:' - '>\)

I noticed however, that this was only working on directories with two or more periods (.) in the directory name. Directories without periods were just ignored by the function.

Is anyone else able to replicate this to confirm that I'm not just doing something dumb.

*edit it's not the two periods that are causing it to work, I'm still trying to work out why some substr correctly works for some directory names but not others

edited: 19/01-24 02:02
#2 : 19/01-24 08:27
Kim Jensen
Administrator
Posts: 929
Reply to #1:
Do you have an example of one of the files that works and one that doesn't?
#3 : 19/01-24 09:59
Jufy111
Posts: 2
Reply to #2:
https://ibb.co/M9RZ5d9
https://ibb.co/0GP7N3K
https://ibb.co/GQ2t4Mg

The following directory name will work
"0020. Joe - Blogs..2"

But the following will not
"0020. Joe - Blogs"


Using windows Version 3.92 windows 64bit

*Edit, added a third, more appropriate screenshot

edited: 19/01-24 10:27
#4 : 19/01-24 13:42
Kim Jensen
Administrator
Posts: 929
Reply to #3:
It is because the folders contain dots. When using the SubStr tag, the program will treat folder names the same way as file names. When using SubStr for files, only the name part and not the extension is used as the subject for the tag. The program use the same behavior for folders. The name of the first folder will then be 0020. Joe - Blogs. where the name of the last is 0020.

File extensions are not used for folders, so it should not matter for SubStr if the folder name contains dots. But I am not sure if I want to change this behavior.

One way to get around this, is to add a Replace method to change the dots to something else.