Extract WriteIndexFile out.
Add .DS_Store to ignore list