Saturday, January 1, 2011

Reparse points

WARNING: This piece of code might delete your files!
Now that I have your attention, I don't provide a binary because of the risk this program might pose on your system, you should read the code and understand what its doing before you execute any line of it, it can and will delete files if used improperly.


YOU HAVE BEEN WARNED!


We all inherited code, systems, installations from someone, somewhere that needed maintenance, some of the ideas we had in the past looked genious to us in the beginning and turned out to be a maintenace hell.


One of these things is NTFS reparse points, or symbolic links (whichever filesystem you choose to use).


NTFS filesystems had no easy way to view, edit, delete or create new reparse points, Gerhild & Hermann created that piece of software called Link Shell Extension.


I needed to write a backup/restore script to recreate all these links after I restored. So I took some APIs from here and there and combined it into this program:


https://sourceforge.net/projects/rpbackup/files/


This specific project has a nice argument parser, it takes care of all the parameter processing for you, you may use it in your own programs as its licensed under MIT.


Take a look at Arguments.cs, the idea was taken from here, but it didn't do what I wanted, so thanks for the idea!


The actual magic is in JunctionPoint.cs, originally from here, but I had to make a modification or two to make it work in our environment.



No comments:

Post a Comment