Skip to content

Instantly share code, notes, and snippets.

@eliziario
Created March 12, 2015 13:04
Show Gist options
  • Save eliziario/1697ce582e8e8459e7f7 to your computer and use it in GitHub Desktop.
Save eliziario/1697ce582e8e8459e7f7 to your computer and use it in GitHub Desktop.
mac os hard link - useful for backuping things with services like google drive or onedrive
#include <unistd.h>
#include <stdio.h>
int main(int argc, char* argv[]) {
if (argc != 3) {
fprintf(stderr,"Use: hlink <src_dir> <target_dir>\n");
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