-   Linux - General (
-   -   Multiple directories with exactly the same name in the same directory! (

pandersson61 02-14-2013 01:58 AM

Multiple directories with exactly the same name in the same directory!
I'm trying to make mirror thumbnails of the files on mac to linux box. But sometimes i get two folders with the same name on my linux box.
To try to make this as easy to follow as possible i'll reproduce my steps below

1.) Rsync directories to mirror directory structure.
(sudo rsync -a --ignore-existing --include='*/' --exclude='*' /Volumes /var/www/img)
2.) Generate thumbnails with imagemagick
3.) Use gnus tar to compress the thumbs and directory structure
(tar -cf)
4.) Unpack the .tar on my linux box

I have tried fsck to merge the duplicate directories without result. At the moment i have no idea on how to proceed.
Does anyone have any idea?

sundialsvcs 02-14-2013 07:08 PM

Sounds to me like you're dealing with a case-sensitive vs. a case-insensitive file system. The default filesystem used by the Mac is case-insensitive, to match the original Macintosh conventions, although Macs (such as mine ...) do have a case-sensitive filesystem available. When setting up my MacBook, I reformatted the drives to use that ... tho' it might be a little too late to do the right thing now.

pandersson61 05-15-2013 08:40 AM

Well the thing is that the mac filesystems are case-insensitive, but the mirrored file system is ext4. So it should not matter on the linux box.
I have attached a tar.gz that contains two directories with the same name. If you unpack it (under linux) you'll get two directories with exactly the same name. But under mac you'll get just one directory.
Strange stuff!
Does anyone have any idea?
Hopefully i will be able to solve this by merging the two directories together.

Checkout the file here, its just 14k.


pandersson61 05-16-2013 02:10 AM

I found the issue, in case someone else encounters the problem ill explain it in short below.

It turns out that OS X uses "utf-8 nfd" and Linux uses "utf-8 nfc". So the character encoding is different (even though it doesn't show in linux).
So you have to convert the nfd filenames to nfc filenames. And you have to do that under Linux, Mac doesn't support using nfc.
There is a handy program to do that and its called "convmv". The command i used to convert all filenames in one folder is:

convmv -f utf8 -t utf8 --nfc --replace --nosmart --notest -r folder-name

Hope this helps someone...

All times are GMT -5. The time now is 09:21 AM.