Jump to content

Directories linked using FileCreateNTFSLink and FileDelete or deleted in Windows deletes ORIGINAL files too?


Recommended Posts

I've started playing with FileCreateNTFSLink to try to do some file linking. If I link a file using it, the copy and the original remain independent in the sense that if I delete the linked file, the original is not deleted. This does not seem to be the behavior if I delete a directory using either FileDelete, or delete within Windows. If I delete the linked file, the original goes with it, and there does not appear to be any way to "unlink" them that I can see, so I have to resort to a backup to get my files back. The way I understand it, there is no way to "hard link" a directory, so it must be using some other method (junction, maybe)? One thing that is a little different is if I use "rd" or "rmdir" from the commandline on the linked folders, the linked files/folders are removed without harming the originals. I'm not sure if this is going to cause problems, so I'm a little reluctant to resort to this without confirmation it's not going to cause problems. Any information would be helpful. Thanks!

Link to comment
Share on other sites

Im not sure making the title bigger than will get you an answer any faster.

If someone can they will help you, but not always is someone who can, instantly available.

I have posted on enough forums to know that. Though it is using the same command, I determined it to be a separate issue. I'm sorry if you don't feel as such. If the mods determine differently, I would be happy to combine the information into 1 post.

Link to comment
Share on other sites

You maybe confused about AutoIt's FileCreateNTFSLink function. One function for 2 different things.

Hardlink - (only files) - is an other file entry in your $MFT pointing to a file content which is already assigned to a file.

you can delete either the original or the new create one, it will not effect the other.

junctions - (folders) - see them as a shortcut inside the file system. If you delete file in such a folder the original files will be deleted.

Under XP use Sysinternals Junction tool to delete a junction.

Link to comment
Share on other sites

You maybe confused about AutoIt's FileCreateNTFSLink function. One function for 2 different things.

Hardlink - (only files) - is an other file entry in your $MFT pointing to a file content which is already assigned to a file.

you can delete either the original or the new create one, it will not effect the other.

junctions - (folders) - see them as a shortcut inside the file system. If you delete file in such a folder the original files will be deleted.

Under XP use Sysinternals Junction tool to delete a junction.

Yeah, that's what I've started finding in my research. My original confusion is probably due to the lack of clarification in the documentation itself. It does not distinguish (and probably should) the 2. It should probably note that deleting the directory link will also delete the original. I have the junction tool, but didn't want to use a separate program to handle it if it could be handled directly with native tools either in Windows or Autoit. As I mentioned, rm/rmdir does seem to accomplish the deletion without deleting the original, and according to wikipedia (under "Command Prompt"), it is safe, though I'd probably like a little more reliable source. fsutil reparsepoint [delete] PathName looks like another possible option that provides a bit more native support. Thanks for the info.
Link to comment
Share on other sites

Yeah, that's what I've started finding in my research.  My original confusion is probably due to the lack of clarification in the documentation itself.  It does not distinguish (and probably should) the 2.  It should probably note that deleting the directory link will also delete the original.  I have the junction tool, but didn't want to use a separate program to handle it if it could be handled directly with native tools either in Windows or Autoit.  As I mentioned, rm/rmdir does seem to accomplish the deletion without deleting the original, and according to wikipedia (under "Command Prompt"), it is safe, though I'd probably like a little more reliable source.  fsutil reparsepoint [delete] PathName looks like another possible option that provides a bit more native support.  Thanks for the info.

I'm no expert on this, just a casual observer with a non "search challenged" disposition.

NTFSLink (Junction) create AND remove junction in AU3 ?

Determine if a Directory is a Junction

replace $FILE_ATTRIBUTE_JUNCTION  with $FILE_ATTRIBUTE_REPARSE_POINT

in _IsJunction($sDirectory) and it returns True for Directory created with FileCreateNTFSLink

Updated link for the now outdated link in the help file to NTFSLink at Novell (in the help file remarks for FileCreateNTFSLink)

http://elsdoerfer.name/ntfslink

Edited by rover

I see fascists...

Link to comment
Share on other sites

I'm no expert on this, just a casual observer with a non "search challenged" disposition.

NTFSLink (Junction) create AND remove junction in AU3 ?

Determine if a Directory is a Junction

replace $FILE_ATTRIBUTE_JUNCTION  with $FILE_ATTRIBUTE_REPARSE_POINT

in _IsJunction($sDirectory) and it returns True for Directory created with FileCreateNTFSLink

Updated link for the now outdated link in the help file to NTFSLink at Novell (in the help file remarks for FileCreateNTFSLink)

http://elsdoerfer.name/ntfslink

Thanks for the links. Yeah, I searched everywhere I could think (in this forum and in google), but had a tough time finding anything that worked. Guess it's one of those times that I didn't even know enough to really search for the right things. Didn't even think to try DirRemove, since once again, the help file only made mention of FileDelete. That gets me pointed in the right direction at least. Thanks again!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...