Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support change of case on case-insensitive file systems #22

Closed
DouglasLivingstone opened this issue Nov 11, 2020 · 4 comments
Closed

Support change of case on case-insensitive file systems #22

DouglasLivingstone opened this issue Nov 11, 2020 · 4 comments
Assignees

Comments

@DouglasLivingstone
Copy link

On Windows, with a case-insensitive but case-preserving file-system, what's the best way to change the case of a file?

For example, this command produces an error message:

$ rnr -f .JPG$ .jpg image.JPG
Error: Conflict with existing path image.JPG -> image.jpg

Currently I'm renaming via a temp file name (eg, rename to .jpg.tmp, then strip out the .tmp). Maybe this would work if the conflict detection ignored the source file when checking to see if the target file exists, which is kind of an edge case due to case-insensitivity where the source file won't conflict once it has been renamed.

@ismaelgv
Copy link
Owner

I think going to the temporal file way is the safest way to do it as you suggested.

Adding a flag to ignore all conflicts is quite dangerous in my opinion, taking in to account the safe nets that rnr provides you. However, I will check if a new flag can be added to ignore the case insensitive situations. This should be done with care because it can cause unwanted side-effects in case sensitive file systems. I am also worried about systems that have both case insensitive with and without case-preserving file-systems mixed, or even case insensitive and case sensitive mixed.

Thanks for providing this feedback, I will take a look in detail. If you have any other insights about this problem do not hesitate to comment.

@ismaelgv ismaelgv self-assigned this Nov 13, 2020
@DouglasLivingstone
Copy link
Author

Thanks, I appreciate that it is probably quite hard to work out whether there will be conflicts in this case since it depends so much on the file system. Very happy with rnr so far, nice and easy to use, thanks!

@ismaelgv
Copy link
Owner

I have added this feature for Windows/MacOS that lets you rename the same file in case insensitive case-preserving file systems. It checks that the name is the same lowercasing source and target file, but it also checks the file metadata to avoid false positives and unwanted file overwrites.

I am very glad you find rnr useful. This will be included in the next release but, in the meantime, you can use it directly from the nightly release if you want to test it. I have added some unit/integration tests and manually test it on Windows, however, any feedback on this side is welcomed.

@DouglasLivingstone
Copy link
Author

Great, I've tried it out and it looks like it is working perfectly. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants