Automated directory compression and replacement