我直接给同步文件夹做了个“硬连接”,方便以后操作。因为很多软件(比如vim)不能读取中文文件夹下的配置文件。
下面是以前摘抄在evernote里的方法:
Snow Leopard can create hard links to directories as long as you follow Amit Singh's six rules:
1. The file system must be journaled HFS+.
2. The parent directories of the source and destination must be different.
3. The source’s parent must not be the root directory.
4. The destination must not be in the root directory.
5. The destination must not be a descendent of the source.
6. The destination must not have any ancestor that’s a directory hard link.
You can't do it directly in BASH then. However... I found an article here that discusses how to do it indirectly:
http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html by compiling a simple little C program:
#include <unistd.h>#include <stdio.h>
int main(int argc, char *argv[]){
if (argc != 3) return 1;
int ret = link(argv[1], argv[2]);
if (ret != 0) perror("link");
return ret;}
...and build in
Terminal.app with:
$ gcc -o hlink hlink.c -Wall
给文件夹 "你好" 创建硬链接 "B":
sudo ./hlink /Users/Biao/Desktop/你好 /Users/Biao/B
Here is the "hunlink.c" program:
#include <stdio.h>
int
main(int argc, char *argv[]){
if (argc != 2)
return 1;
int ret = unlink(argv[1]);
if (ret != 0)
perror("unlink");
return ret;}
gcc -o hunlink hunlink.c
删除文件夹 "你好" 的硬链接:
sudo ./hunlink /Users/Biao/B