How can I copy files/folders in a case-insensitive manner?

Okay, so it’s for a game mod, so it’s technically gaming related but I figure this is more of a general command thing so here I am. Mod contains hundreds of files/folders which need to merge with existing folders and overwrite existing files.

The problem is that the mod author packaged most of the replacement files in lower case and most of the originals (not all) are in upper case. Not a problem for those on Windows but with Linux being case sensitive we end up with a bunch of files of the same name in different cases causing conflicts. e.g.

mod contains

Original contains

Now the original casing has to be kept intact as there are other files that the mod doesn’t provide replacements for.

You can use a bash script to change all file names to lower case (it’s a little more complex with directory names, as well) - run it from the directory of the game mod or change loc variable accordingly.
Try on your own risk. :wink:


find "${loc}" -type f | while read file; do
    file_name=$(echo "${file_name}" | tr "[:upper:]" "[:lower:]")
    mv "${file}" "${file_dir}${file_name}"