I have a script which, for the currently selected files, pops up a detached dialog and takes input from the user.
It then moves and renames the currently selected files according to the dialog inputs.
The script configures a string to execute a rename internal command and executes that.
With fantastic help here: Rename then copy MOVE a file fails because windows still thinks file has old filename
I have gotten this far.
I was not sure if it is better practise to add this question on to the bottom of that post but since it has been a while and this is (I hope seen as) a very specific question about the mechanics of the rename command.
Fault Description
The script sometimes works and sometimes not.
In my recent testing to file disappears from the source folder and does not appear in the (intended) destination folder. I am not sure where it ends up. Executing the undo line brings it back to its original location.
Objective
To investigate the apparent double backslashing I see below and see if this is causing my script to break
Double Backslashing Observed:
Refer to screenshot below.
A single file is selected and the script invoked.
This brings up the dialog
Within my script is a variable containing the rename command as assembled according to the inputs
When printed out this rename string is shown
In the rename string is a construct referencing a folder alias.
This alias resolves to the folder path as shown
This action I believe is a Code for passing a path:
Item is the undo log entry after the rename command has been run.
The destination folder is of interest here.
As you can see there seems to be a double backslash between folders in the path for all folders accept the last/leaf folder where the file will reside.
Should this be like that?
Could that be breaking my script?
With my sincere thanks as always
@Ixp greetings thx for reply.... well I am not sure actually either way.
That last blog you helped me on I never fully understood some of the things you were pointing out especially the bug(s).
Am I just suffering from bugs you documented here?: Esc* modifiers eat backslashes
If so case closed. I am thinking up a possible workaround where I do not use aliai just the folder path instead.
One thing I have realised for benefit of anyone else interested is that my symptoms seem intermittent.
If the double backslash detailed about is the problem (or a problem) then it does not always break my script.
This example below (MyRef 2023-12-02 050 CP0001 Works) has the same double backslash problem but it works. The file is renamed and moved to the destination folder successfully. This example is a little different to the one above so (Delta1, delta2 below) so I should investigate those.
Update - I have dispensed with the use of Folder Aliai in my strings and working exclusively with folder paths. This is proving much easier and I have a bit of traction. Thank goodness.
In this vein I have hit upon a problem related to the kind help provided above by the indefatigable @lxp ... which on account seems to be a pure JavaScript problem I have located it in the Off-topic forum....here: Find and Replace Backslash in a JavaScript String