so@brownie.cs.wisc.edu (Bryan So) (09/19/90)
I tried out the GNU-ish MSDOS file utilites. Most of them are great! Thanks for the port. However, the following command line: mv ..\test . where "test" does exist gives the following error: cannot move ..\test to ./..\test The file does not get moved but it is removed! Does anybody know whom should I send the bug report? Further, there seems to be no shareware/pd versions of mv that conforms to UNIX semantic, in particular, will recursively move a directory. The GNU port can rename a directory but will not move. Is it that difficult? Bryan
pinard@IRO.UMontreal.CA (Francois Pinard) (09/20/90)
In article <11303@spool.cs.wisc.edu> so@brownie.cs.wisc.edu (Bryan So) writes:
Does anybody know whom should I send the bug report?
GNUish MS-DOS should mainly be reported to:
Thorsten Ohl <td12@ddagsi3.bitnet>
who moderates this project. I'm forwarding to him a copy of your article.
--
Franc,ois Pinard ``Vivement GNU!'' pinard@iro.umontreal.ca
(514) 588-4656 cp 886 L'Epiphanie (Qc) J0K 1J0 ...!uunet!iros1!pinard
phys169@canterbury.ac.nz (09/26/90)
In article <11303@spool.cs.wisc.edu>, so@brownie.cs.wisc.edu (Bryan So) writes: > > Further, there seems to be no shareware/pd versions of mv that > conforms to UNIX semantic, in particular, will recursively move > a directory. The GNU port can rename a directory but will not > move. Is it that difficult? > I have a move command that will move whole directories (and any subdirectories), but otherwise isn't all that *ix-comaptible. If you want a copy let me know. The reason it is difficult is that the DOS call that renames files across directories doesn't work with directories, and the sneaky way of renaming directories (after knocking off the directory bit temporarily) doesn't rename across directories. It is possible to move directories around on the same disk by stretching compatibility a little, but my program moves directories the slow-but-safe way, that also lets it work with JOIN'ed disks, etc. It still moves individual files quickly, if it can. Mark Aitchison, Physics, University of Canterbury, New Zealand.
friedman@apple-gunkies.ai.mit.edu (Noah Friedman) (10/02/90)
In article <1990Sep26.102324.9233@canterbury.ac.nz> phys169@canterbury.ac.nz writes: >In article <11303@spool.cs.wisc.edu>, so@brownie.cs.wisc.edu (Bryan So) writes: >> >> Further, there seems to be no shareware/pd versions of mv that >> conforms to UNIX semantic, in particular, will recursively move >> a directory. The GNU port can rename a directory but will not >> move. Is it that difficult? >> >I have a move command that will move whole directories (and any >subdirectories), but otherwise isn't all that *ix-comaptible. If you >want a copy let me know. The reason it is difficult is that the DOS call >that renames files across directories doesn't work with directories, and >the sneaky way of renaming directories (after knocking off the directory >bit temporarily) doesn't rename across directories. It is possible to >move directories around on the same disk by stretching compatibility a >little, but my program moves directories the slow-but-safe way, that also >lets it work with JOIN'ed disks, etc. It still moves individual files >quickly, if it can. > My XT is down at the moment, so I haven't bothered to write and test my own mv program, but here is how I would plan the program: (Note: When making reference to the DOS rename service, I refer to the newer one, requiring a pathname, not FCB) 1) If the file is a plain file, just use the rename service, which will rename across directories. 2) If the file is a directory, see where the destination is. If the destination is the same directory as the source, again, just use the DOS rename service. 3) If the directory is to be moved and/or renamed to another directory, and the destination is on the same filesystem (disk), perform the following steps: a) using absolute disk reads and writes, find the directory name in its parent table. b) Remove the directory attribute bit (you cannot do this with the chmod services, so you have to read in the disk sector, modify it, then write it back out). c) Rename the directory just as if it were a normal file. Note that you can move this directory anywhere you want now (because it is a plain file) on the disk. d) Modify the second entry of the moved directory so that the "parent" link now has the correct cluster number in it (you'll have to find this using abs diskreads again). If you neglect to do this, then strange things will happen when you "cd .." from that directory. I imagine that what would happen is that you'd be put back in the directory that the moved directory originated from, not its current parent. In any case, there would be confusion. e) Change the file back into a directory, again using abs diskreads and writes. Note that this automagically moves all the subdirectories under the directory to be moved - they don't have to be touched! 4) If the directory is to be moved to another filesystem (disk), there isn't much else you can do besides a recursive copy and delete. These are fairly trivial, so I won't explain how to do them. See what a nuisance this is? I don't understand why Microsoft didn't write the rename service to do this. I spend more time working *around* MS-DOS than I do working *with* it. Sigh. I intend to do this myself, and if anyone else is interested in the sources (which I should have completed in 3 weeks or so - I can't start on the thing right away), I'll post an FTP site where it will be available. In the meantime, if someone else does it first, this is the recipe I would follow for writing the program. --- Noah Friedman friedman@ai.mit.edu Disclaimer: These opinions, statements, comments, etc. are not representative of any organization including MIT or the FSF.