Just now when I open my documents folders, I was deeply mixed up by their icons.
Basically, text is also a kind of visual image. However, people need to decode, prefixly comprehend their meaning, and then recieve those signals. Relatively, normal iamge is much faster to be read than text.
And that’s why I usually clicked into the wrong directory. So I decided to change the icons of those folders.
One of the benefits under OS X is that users can just drag image into the folder’s info dialog and then its icon would be changed. But I’d like this process to be more “formally“. In other words, I want to convert images to be .icns types and then use them.
There had been many apps in Mac App Store achieving the function. But hundreds of reasons are suitable for me to reject using them, such as price, size, security and so forth. Frankly speaking, I want to build a bash script by myself.
- First it scan the working directory and put available image names into file list. The reason I do not use variable is because filenames containing spaces would cause problem.
- Loop each by each, call system commands
qlmanageto handle image process.
iconutilto create ICNS files.
- Remove caches.
- Download it.
- Collect the images you want to covert and put them together with this script file in the same directory.
- Give it executable permission by enter
chmod +x buildICNS.shin terminal.
- In terminal, enter
- This script will NOT hurt your original image files.
- Actually I was going to push this post earlier, but I found that the formal script could be extended. For example support .svg and .pdf, support file name containing spaces. So I studied the shell language for some basic skills for accomplishing these functions. My mum was thinking I am mad. I am not!!! Just I enjoy learning and coding.
- Tutorials-for-Web-Developers/Shell编程极简入门实践.md at master · StevenSLXie/Tutorials-for-Web-Developers
- 入门bash Shell脚本
- List files with certain extensions with ls and grep
- Bash Scripting & Read File line by line
- How to manually create icns files using iconutil?