Vì tôi đã thấy mình thực hiện Folderthủ thuật hết lần này đến lần khác, cuối cùng tôi đã tạo ra một tập lệnh bash để tự động đổi tên chuỗi /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/InfoPlist.strings.
- Lưu nó như ví dụ
finder-folders-first.sh
- Làm cho nó thực thi:
chmod +x finder-folders-first.sh
- Chạy với quyền root:
sudo finder-folders-first.sh
#!/bin/bash
# Make folders sortable first in Finder
if [[ $EUID -ne 0 ]]; then
echo "Script must be run as root! Aborting."
exit 1
fi
cd /System/Library/CoreServices/Finder.app/Contents/Resources/English.lproj/
cp -i InfoPlist.strings InfoPlist_ORIGINAL-`date +%b-%d-%Y_%H_%M_%S`.strings
plutil -convert xml1 InfoPlist.strings
sed 's|<string>Folder</string>|<string> Folder</string>|' InfoPlist.strings > InfoPlist_PATCHED.strings
diff InfoPlist.strings InfoPlist_PATCHED.strings
if [ $? -eq 0 ]; then
echo File already patched! Exiting.
exit -1
else
echo Patching original file...
plutil -convert binary1 InfoPlist_PATCHED.strings -o InfoPlist.strings
fi
echo Restarting Finder...
killall Finder
echo Done!
Dòng cuối cùng khởi động lại Finder. Để thực hiện điều tương tự từ GUI, nhấn Alt + nhấp chuột phải vào biểu tượng Finder trong Dock và chọn Relaunch.
Bây giờ, trong Finder, nhấp vào cột Loại một lần / hai lần để có các thư mục được liệt kê là đầu tiên / cuối cùng.
Điều này hoạt động trong Mavericks và Yosemite, nhưng có thể không hoạt động trong các phiên bản sau.