DOPUS strips trailing periods during script operations while feeding back filename with them

I found the root cause of the issue described in another one of my posts (@ifexists and Eval Clause checking path always results in a false boolean output - #9 by Leo)

In essence when a folder name ends with zero or more periods ( . ) (with or without spaces between them) DOPUS is stripping those trailing periods.

As you can see from the below picture, the directory opus folder dialog does not seem to be aware that DOPUS is stripping those trailing periods either. In the example below I input "testing...", which unbeknownst to the user is changed to "testing" and in this instance errors out as the folder "testing" already exists.

The same concept applies to scripts, where the selected or stored file will be different than what's actually on disk due to the automatic removal of periods. This will create issues in a case, for example, where you are trying to pack multiple files into a folder but fails due to the directory for the files to be packed to not existing as the name has been changed by DOPUS.

My question at this point would be if there is any way to control this behavior or some way to account for this automatic directory name change within a script / function?

Can you create a folder in DO that ends in a period? e.g. via Create Folder dialog.

It's not just Opus. Windows does that. Try mkdir Moo... in a command prompt and you'll get a dir named Moo.

There is a way to bypass the usual Windows naming rules and add dots at the end of folders, but it will confuse almost all software, so I don't recommend it.

Opus can rename and delete folders with dots at the ends of their names, but won't let you create one by accident, due to the problems that would cause in everything else.

Got ya. Is there a specific regex pattern used to strip trailing period and space characters from the end of directory names? I figure it would be best to reproduce it exactly to ensure any changes done by windows are reflected in the script thus preventing any potential errors.

It's not done using regex (and in at least some cases it's Windows that will be doing it, not always Opus itself) but anything that simply removes all spaces and dots from the end of the name should have the same result.

1 Like

Thanks Leo! That's exactly what I needed to know.

1 Like

For anyone that may run into the same issue in the future the following RegEx pattern works:

[\.\s]*\.+[\.\s]*$

In JScript you want it to look like this:

/[\.\s]*\.+[\.\s]*$/g