Created
April 15, 2011 15:18
-
-
Save kommen/921866 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What? | |
Command line tool to create hard links to directories with Mac OS X (10.5 or later). This is used by Time Machine. | |
Credits: | |
http://www.mactech.com/articles/mactech/Vol.23/23.11/ExploringLeopardwithDTrace/index.html | |
http://osxbook.com/blog/2008/11/09/hfsdebug-40-and-new-hfs-features/ | |
Restrictions: | |
The hard link must be created in a directory different from the source directory's parent. See example below. | |
How? | |
Compile: | |
$ gcc -o hlink hlink.c -Wall | |
Link: | |
./hlink <source_dir> <target_dir> | |
Example: | |
$ mkdir test1 | |
$ mkdir test2 | |
$ ./hlink test1 test2/test3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment