Create NTFS junction point in Python
Question: Is there a way to create an NTFS junction point in Python? I know I can call
the `junction` utility, but it would be better not to rely on external tools.


Answer: you can use python win32 API modules e.g.

    
    
    import win32file
    
    win32file.CreateSymbolicLink(srcDir, targetDir, 1)
    

see
<http://docs.activestate.com/activepython/2.5/pywin32/win32file__CreateSymbolicLink_meth.html>
for more details

if you do not want to rely on that too, you can always use ctypes and directly
call CreateSymbolicLinl win32 API, which is anyway a simple call

here is example call using ctypes

    
    
    import ctypes
    
    kdll = ctypes.windll.LoadLibrary("kernel32.dll")
    
    kdll.CreateSymbolicLinkA("d:\testdir", "d:\testdir_link", 1)
    

[MSDN](http://msdn.microsoft.com/en-us/library/aa363866%28VS.85%29.aspx) says
Minimum supported client Windows Vista

