Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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;
- }
- $ gcc -o hlink hlink.c -Wall
- #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
- hlink source_folder target_folder
- -d, -F, --directory
- allow the superuser to attempt to hard link directories (note:
- will probably fail due to system restrictions, even for the
- superuser)
- sudo ln -d existing_dir new_hard_link
- unlink new_hard_link
- link: Operation not permitted
- rsync -av --copy-dirlinks --delete ../htmlguide ~/src/
Add Comment
Please, Sign In to add comment