Skip to main content
1 of 3
Aeronaelius
  • 613
  • 4
  • 11
  • 20

Merging folders with practically the same name but different casing

When digging around in the advanced settings in Dropbox I lost a folder. I only discovered this about a month later. I managed to get this folder back from Dropbox however the file structure of the subfolders have changed dramatically. The current folder now contains two versions of each original subfolder. Currently it looks like this:

folder
  /folder1
    /folder11
      /folder111
      /Folder111
       /file1111
       /file1112
       /file1113
    /Folder11
      /file111
      /file112
    /folder12
    /Folder12
  /folder2
  /folder3  

So I have lowercase subfolders and I have BumpyCase subfolders. The lowercase subfolders contain subsubfolders and the BumpyCase subfolders contain files. The subsubfolders again contain a lowercase and a BumpyCase version of their respective subfolders. And this story goes on for several levels deep.

Fortunately there is no duplicity in files, only in folders (same letters but different casing). So on each level I need to merge folders which differ only in the casing of names. And to do this correctly I need to start at the deepest level and work myself up to the top level folder.

Is there a handy linux command/tool or someone with an idea for a script which could accomplish this? I am already very happy that I got my stuff back, but the current structure is a big inconvenience.

Many thanks in advance!

Aeronaelius
  • 613
  • 4
  • 11
  • 20