Reputation: 695
I'm assuming with a call to a UNIX shell, but I was wondering if there are other options from within Python.
Upvotes: 0
Views: 2582
Reputation: 3090
My guess would also be that it is a permission problem. For me (OS X 10.7.3), this works:
$ ls
slask.py system.py system1.gif system2.gif
$ python
>>> from os import *
>>> link('system2.gif', 'mylink.gif')
>>> exit()
$ ls
mylink.gif slask.py system.py system1.gif system2.gif
And just to make it clear, "Hard links may not normally refer to directories and may not span file systems."
This is because hard linking a directory could create an infinite loop. So directories need to be created using os.mkdir. Then files can be hard linked into that new directory.
Upvotes: 4
Reputation: 10260
os.link
claims to work on all Unix platforms. Are there any OS X specific issues with it?
Upvotes: 1