Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Here's the deal, I have a huge mess of files on an external drive that is formatted as NTFS. I wish to copy all of these files onto my MacBook Pro.

NTFS, like sane filesystems, is case sensitive. HFS is not.

There is, somewhere in the mess of tens of thousands of files and directories, one or more 'duplicates' in the eyes of HFS. Theses are preventing me from copying the entire directory of data onto my mac.

(MacOSX rather unhelpfully throws a general error explaining the problem, but not the exact file. It also doesn't give you an option to skip)

What is the best approach to solve this? Does anyone know a tool that can find files and directories that have the same case-insensitive name?

--Edit--

So I did a cp -i and left it running overnight with the intention of waking up and seeing it stuck on a duplicate, but when I woke up it had finished! However, the resulting directory had 13,906 items while the original has 13,914, so it sounds like cp either doesn't recognise files that are the same given case insensitivity, or it ignores them even with -i.

share|improve this question
    
Out of curiosity, how did you end up with these dupes? Have you been using the POSIX subsystem under Windows? –  Hugh Allen Apr 2 '10 at 8:10
    
But Mac OS X doesn't use HFS. It uses HFSX, a variant of HFS+ with optional - wait for it - case sensitivity. –  user135 Apr 2 '10 at 10:46
    
@Graham, awesome, can I turn it on without formatting my entire drive? –  SCdF Apr 2 '10 at 15:28
    
@Hugh, it's a bunch of data from a previous Linux install, but on NTFS for various reasons (it's the easiest to get working on all 3 OSs for a start) –  SCdF Apr 2 '10 at 15:30

5 Answers 5

up vote 4 down vote accepted

I don't know if this is the best approach, but the following command does what you want and lists you all files and directory entries for which duplicate case insensitive names exist:

find /path/to/check -type f -o -type d | tr A-Z a-z | sort | uniq -d

What it does is, find all files and directories in /path/to/check, makes the output lowercase, sorts those entries (required since uniq only compares adjacent lines) and filters to only show duplicate lines i.e. duplicate file or directory entries.

Example: If I wanted to check my Bootcamp Volume on OS X for duplicates I would open Terminal.app and execute

find /Volumes/BOOTCAMP/ -type f -o -type d | tr A-Z a-z | sort | uniq -d
share|improve this answer

I use Double Commander, which is a Total Commander alternative for Mac OS X. It has the same look and feel as TC and the same Search function. Easy Find is good and convenient, but I found this quicker most of the time. I just looked up all my *.iso files quickly on my NTFS partition.

share|improve this answer

can I turn it [case sensitive HFSX] on without formatting my entire drive

You may create a case sensitive disk image on Mac OS X which can be mounted as a normal hard drive volume.

# cf. http://codesnippets.joyent.com/posts/show/8617
IMAGE="${HOME}/Desktop/Case Sensitive Test.dmg"
VOLNAME="Case Sensitive Test"

hdiutil create "${IMAGE}" -size 10m -fs HFSX -volname "${VOLNAME}" -layout NONE

hdiutil attach "${IMAGE}"

cd "/Volumes/${VOLNAME}"
touch foo.txt Foo.txt
open .
ls -l [Ff]oo.txt
stat -f "inode: %i  --  name: %N" [Ff]oo.txt

cd ~
hdiutil detach "/Volumes/${VOLNAME}"
share|improve this answer

I haven't used it, but iPartition claims to be able to nondestructively convert between HFS+ (case-insensitive) and HFSX (case-sensitive).

share|improve this answer

From Mac OS 10.3 on the command newfs_hfs -s will create a case-sensitive new file system.

share|improve this answer
    
That's good to know for future reference, but I can't create a new filesystem, I'm very much stuck with the one I have. –  SCdF Apr 2 '10 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.