BUG: file rename has "same source-destination names" error

Discussion & Support for xplorer² professional

Moderators: fgagnon, nikos, Site Mods

Post Reply
narayan
Platinum Member
Platinum Member
Posts: 1430
Joined: 2002 Jun 04, 07:01

BUG: file rename has "same source-destination names&quo

Post by narayan »

I tried to rename a file that has a space in the beginning.
x2 gives this error:
-----------------------------------------------------------
Rename file
-----------------------------------------------------------
The source and destination file names are the same.
 <File details>

                                                         [Cancel]
-----------------------------------------------------------

I confirmed that there is no name conflict if I remove the space.
The only way to proceed is to temporarily add some more characters and then save. Then once again edit the file name back to original.
Gandolf
Gold Member
Gold Member
Posts: 470
Joined: 2004 Jun 12, 10:47

Post by Gandolf »

Furthermore:
Trying to rename " test1.txt" to " test2.txt" by changing the 1 to 2 results in a file with the name "test2.txt". It appears that the leading space is removed by the renaming.
Kilmatead
Platinum Member
Platinum Member
Posts: 4578
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

This is a quirk of how the shell rename function itself works - it automatically strips leading and trailing spaces - you'll find that the same thing happens in Windows Explorer.

In x2, using <Ctrl+F2> to rename a file will allow for leading spaces.

Also other programmes, namely dedicated renaming utilities such as the oft-recommended ReNamer are able to handle writing leading/trailing spaces without a problem.
narayan
Platinum Member
Platinum Member
Posts: 1430
Joined: 2002 Jun 04, 07:01

Post by narayan »

It must be a sunny day in Ireland!  :twisted:

No the problem is not with auto-trimming; although I don't like OS doing something that the user does not intend/anticipate.

In this case, I actually wanted to remove the leading space, and nothing else. But x2 does not let me do that.

Further, the error is misleading.
1. You can have name-conflicts as a result of renaming. (That's not the case)
2. You can have "same folder" situation in file-transfer. (That's not the case)
3. A renaming is always in the same folder. so the source and destination folders are ALWAYS the same in a renaming operation. How is that an error??
Kilmatead
Platinum Member
Platinum Member
Posts: 4578
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

narayan wrote:In this case, I actually wanted to remove the leading space, and nothing else. But x2 does not let me do that.
As <Ctrl+F2> seems to be some kind of Robust Rename (:shrug:), that will also allow you to remove leading spaces in peace as well.

Again, the error you are seeing is coming from the shell itself because you are using Windows' renaming function - attempting to remove leading spaces manually in Windows Explorer will result in the same message.  (In other words, don't use <F2> or right-click Rename for operations such as these - if you can cajole Nikos into abjuring Windows' rename altogether, I'm all for it [being a right-click man myself], but I wouldn't hold my breath.)

I have no explanation as to why Windows/NTFS behaves this way, and to be honest a discussion of PIDL conflicts (how Windows internally represents individual objects in the table [i.e., "Pointer to an Identifier List"] - representing what is loosely called a "Filename") would make my head hurt at this time day.  PIDL's are best left as something puppies do on the floor.
Post Reply