Checking for case conflicts

The cloud service I'm using has case-sensitive files. On Windows, you can set a directory to allow for case-sensitive files, but it's a bit of a pain in the ass.

As part of the script I'm working on, I would like to have rclone check to see if there are filenames on the remote server that have the same name but in different cases—without initiating any sort of download—and list what those conflicts are.

hello and welcome to the forum,

can you give a detailed example, from a programmer's perspective?

Sorry, typo, I'll fix it. I meant to say check if there are filenames on the remote server that have the same name but in different cases.

As an example, if there is are two files named 'foo' and 'FOO' in the same directory on the remote server, I want it to tell me about that conflict.

if you had the same two files in a local dir, how would you find that conflict?

That's what I'm wanting to know. I'm hoping rclone has a feature stashed away somewhere that could let me know about conflicts like that.

and what about Foo and fOO?

Yes, that's also a case conflict. I would want it to report that too.

Rclone has these flags to help with case sensitivity. By default a sync to a windows local filesystem will force a case insensitive sync.

Global Flags:
      --ignore-case        Ignore case in filters (case insensitive)
      --ignore-case-sync   Ignore case when synchronizing

Backend Flags:
      --local-case-insensitive   Force the filesystem to report itself as case insensitive
      --local-case-sensitive     Force the filesystem to report itself as case sensitive

If you use a case insensitive sync then rclone will assume FOO and Foo are the same file which is generally what you want.

However if you have a file called FOO and Foo in the same directory in the source and you do a case insensitive sync, you'll get a warning

2022/03/03 09:28:47 NOTICE: Foo: Duplicate object found in source - ignoring

So grepping these out is probably what you want.

If you run with --dry-run you will still get the NOTICE but nothing will be transferred.

If you run with --dry-run you will still get the NOTICE but nothing will be transferred.

Ah, perfect! Thank you.

I can combine this with rclone copy remote: local: --create-empty-src-dirs --fast-list --exclude "{*.*,*}" to create the directory structure in advance, since Windows – annoyingly – makes you enable case-sensitivity on a folder-by-folder basis with no option for inheritance or recursion.

1 Like

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