Thread View: comp.sys.ibm.pc.programmer
2 messages
2 total messages
Started by XIAO Yan
Wed, 29 May 1991 15:38
Symbolic link in MS-DOS
Author: XIAO Yan
Date: Wed, 29 May 1991 15:38
Date: Wed, 29 May 1991 15:38
20 lines
1158 bytes
1158 bytes
A otherwise accident freshes my dream of symblic link of fils in MS-DOS. (much like under unix 'ln -s'). When I used chkdsk and I was told two files were cross linked to the same claster. These two files are on the same disk but in different directories and orginally they are different files. After I saw this message I found that, indeed, these two files contained the same contents. I recalled that this happened after I used PCTOOLS to undelete one of the files. So I assume that it is feasible to have symbolic link on MS-DOS. Along the same line, it should also be possible to have cross directory rename command (rather than 'copy-delete' scheme which sometimes is hard to do). I am no expert in FAT stuff. Any comment? Xiao
Re: Symbolic link in MS-DOS
Author: Robert J Carter
Date: Thu, 30 May 1991 04:51
Date: Thu, 30 May 1991 04:51
62 lines
3231 bytes
3231 bytes
In article <1991May29.153829.8742@bullet.ecf.toronto.edu> xiaoy@bullet.ecf (XIAO Yan) writes: >A otherwise accident freshes my dream of symblic link of fils in MS-DOS. >(much like under unix 'ln -s'). > >When I used chkdsk and I was told two files were cross linked to the >same claster. These two files are on the same disk but in different >directories and orginally they are different files. After I saw this >message I found that, indeed, these two files contained the same >contents. > > .... > >So I assume that it is feasible to have symbolic link on MS-DOS. Nope. The reason is this: the FAT and file system do not track links (therefore, they don't exist). When you create a file in DOS, a field in the directory entry for that file points to an entry in the FAT table (The starting cluster that chkdsk referred to). When a file is deleted, the operating system a) marks the directory entry as "erased" by placing hex E5 in the first character position of the file name and b) using the starting cluster information to track the chain of allocated clusters AND MARK THEM AS FREE. Thus, you get to erase two files for the price of one. In the meantime, your other file is now pointing into never-never land (hard disk purgatory ?). Same applies to floppies. >Along >the same line, it should also be possible to have cross directory rename >command (rather than 'copy-delete' scheme which sometimes is hard to do). >I am no expert in FAT stuff. > >Any comment? > >Xiao Yes, you could do a cross-directory rename, with the caveat that you could step in much doggie-do if your machine goes down during the process, although the window would be very small. (I wrote a programme to do this a couple of years ago - god knows where it is now). Basically, this is the procedure: - Open the source directory - Open the destination directory - Read the directory entry for the file to be moved - Write the *IDENTICAL* information into an empty directory entry in the destination directory - Mark the source directory entry as deleted. Please note that I said MARK - DO NOT use the O/S Delete File system calls. - Close the source and destination directories. Note: NO mucking about with the FAT is involved! This is a (all things being relative) simple, 1 to 2 page C programme, using nothing more than open(), close(), read(), and write() calls. I can e-mail you the details if you wish. -- |=================================================================| ttfn! | Robert J Carter Oghma Systems Ottawa, Ontario | | Phone: (613) 565-2840 | @ @ | Fax: (613) 565-2840 (Phone First) rjc@oghma.ocunix.on.ca | * * |=================================================================| \_____/
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads