/ntfslink-python

Python extension allowing some basic manipulation over Win32 junction points, symbolic links, and hard links.

Primary LanguagePython

Python NTFS Links Module

What is it?

A ctypes based Python module for manipulating reparse points (junctions/symbolic links/etc) and hard links on the Windows version of Python. Originally this was written to be a C-extension, but ctypes appears to be the more portable solution. At the moment, this project is still a work in progress, and is being rewritten from the ground up to utilize on ctypes. It currently supports the manipulation of junction points, symbolic links, and the ability to check for support of symbolic links.

While symbolic links are officially only supported on Windows Vista and higher, Windows XP users can also utilize them by installing a custom driver:

I have nothing to do with that project, but I did go ahead and add logic for checking for it in the functions dealing with symbolic link support.

Improvements

Version 2 will include the following improvements over the original module.

  • Python 3 Support
  • Custom reparse point manipulation.
  • C extension with a ctypes fallback.
  • Less stupid approach to checking WinXP symlink support.
  • Better performance in the ctypes implementation.
  • Correct privilege acquisitions for the current OS.
  • Better hardlink support. (ability to enumerate a file's hardlinks)
  • Tests/Documentation/PyPi publishing

Installation

Ignore below. The setup doesn't work at the moment, as I've begun rewriting this project from scratch. If you need some functionality already implemented, feel free to just grab what you need from the code.

Standard module building command.

To build in the local directory:

setup.py build

Or to install:

setup.py install

Credits

Much of the code was derived by reimplementing pieces of the reparselib, who's full source code can be found at reparselib.

Additionally, thanks goes out to the following Stack Overflow users for explaining a few concepts/methods to me:

TODO:

See the project issues.