I have 2 files, lets say FILE1 and FILE2. I want to have a hard link
FILE3 that points to one or the other (and switch between them from time
to time).
I switch the link from FILE1 to FILE2 by deleting FILE3 and creating a
new hard link also called FILE3 that points to FILE2.
Now the problem is when FILE1 is read-only. I can't delete my hard link
without making it writable first. But that will make the original file
also writable.
Is there any trick to do what I want without messing up the
read-onlyness of the original files?
One way is to restore the attributes of FILE1, but in the general case I
don't know where it is, and it may even be deleted. Is there a way to
locate the original file from a hard link? Or more accurately - is there
a way to locate another hard link to the same file if one exists?
Thanks
Ivo
P.S. I tried this in Explorer - I created a read-only file, created a
hard link to it, then deleted the hard link and emptied the Recycle Bin.
The original file was then writable.
"Ivo Beltchev" <i...@home.com> wrote in message
news:Olu6i7$WKHA...@TK2MSFTNGP04.phx.gbl...
Symbolic links won't work for me. I want to be able to replace the
original files (by deleting them and re-creating them) without affecting
the hard link. As far as I understand, a symbolic link will be updated
when the source file is replaced.
Basically I want a transparent "copy on write" scheme with as few quirks
and side effects as possible. Currently I am copying the files normally
(CopyFile) but I want to make it faster when possible because the files
can be quite large.
--pa
"Ivo Beltchev" <i...@ivo.com> wrote in message
news:OjNrXEGX...@TK2MSFTNGP04.phx.gbl...
If you want faster copy, forget CopyFile, especially under XP and Vista.
Win7 might have gotten better file copy implementation. Write your own
non-buffered (FILE_FLAG_NO_BUFFERING), large chunks copy routine. DON'T use
FILE_FLAG_WRITE_THROUGH. You'll be able to get then half of the disk
sustained transfer rate, without nasty side effects of file cache bloat
(which kills XP CopyFile).
"Ivo Beltchev" <i...@ivo.com> wrote in message
news:OjNrXEGX...@TK2MSFTNGP04.phx.gbl...