How to sync folder/file rename (lowercase to uppercase)

kinda thought that but never used --track-renames until now. thanks for the cofirm.

well, not sure i see the issue.
i assume that --disable CaseInsensitive means that the operation should be case sensitive.
and windows has no issue renaming FILE.TXT to file.txt

Just to correct myself (again).. This theory is busted. Tested with a small C++ application which simply executes

MoveFileEx(L"C:\\Temp\\y\\test.txt", L"C:\\Temp\\y\\TEST.txt", MOVEFILE_REPLACE_EXISTING);

And it successfully performs the casing-only rename from test.txt to TEST.txt.

Edit: Also tested a go application, with the rename operation that I think is doing the MoveFileEx above. It also works. Also tested with and without the \\?\ prefix that rclone normally uses, with no change.

err := os.Rename(`C:\Temp\y\test.txt`, `C:\Temp\y\TEST.txt`)

--case-great-minds-think-a-like

as you were writing your post, i was writing my post just above.
we agree that windows has no issue renaming a file from test.txt to TEST.TXT
but i did the test from the command line.

dir /b
test.txt

ren test.txt TEST.TXT

dir /b
TEST.TXT

Sure.

Yes, but it isn't really case sensitive - everywhere. E.g. if i have a file test.txt, I can successfully rename it with this command:

MoveFileEx(L"C:\\Temp\\y\\TEST.TXT", L"C:\\Temp\\y\\tEsT.txt", MOVEFILE_REPLACE_EXISTING);

So the reference to source file TEST.TXT also matches a source file test.txt. This may/will lead to different issues.. E.g. my case 1 earlier that resulted in deletion of the destination file, when I ran:

rclone sync C:\Temp\x C:\Temp\y --disable CaseInsensitive

your concern is a case where the source folder that looks like this?

rclone.exe ls b:\x 
        1 TEST.TXT
        1 test.txt

Given:

C:\Temp\x\test.txt
C:\Temp\y\TEST.txt

Running:

rclone sync C:\Temp\x C:\Temp\y --disable CaseInsensitive --track-renames

What I think is happening:
The track-renames logic will find that C:\Temp\y\TEST.txt should be renamed to test.txt. But before doing the rename (move) operation, it checks if the result of that operation already exists and is in the way. It performs a os.stat operation on path C:\Temp\y\test.txt, and oops - that returns successfully the file info, even though it in reality is for C:\Temp\y\TEST.txt. Rclone then concludes it needs to delete C:\Temp\y\TEST.txt first, and then rename C:\Temp\y\test.txt to TEST.txt. Unfortunately C:\Temp\y\TEST.txt and C:\Temp\y\test.txt are the same file, so after deleting C:\Temp\y\TEST.txt to clear the path for rename, the rename operation fails with The system cannot find the file specified.

No. I have just folder x and folder y, each with 1 file in.

C:\Temp\x\TEST.txt
C:\Temp\y\test.txt

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.