[comp.os.msdos.programmer] Another TC findfirst

bgeer@javelin.es.com (Bob Geer) (02/27/91)

While writing my own file move routine for moving/renaming a file to
another directory (without copy-deleting) I found I couldn't move or
rename directories.  I haven't had the time to pursue it yet...will
some magic combination of file attribute bits make this possible?
TIA!

-- 
<> Bob `Bear' Geer <>               bgeer@javelin.sim.es.com              <>
<>      Alta-holic <>   speaking only for myself, one of my many tricks   <>
<> Salt Lake City, <>    "We must strive to be more than we are, Lal."    <>
<>          Ootah  <>           -- Cmdr. Data, learning schmaltz          <>

valley@uchicago (Doug Dougherty) (02/27/91)

bgeer@javelin.es.com (Bob Geer) writes:

>While writing my own file move routine for moving/renaming a file to
>another directory (without copy-deleting) I found I couldn't move or
>rename directories.  I haven't had the time to pursue it yet...will
>some magic combination of file attribute bits make this possible?
>TIA!

Apparently, you have to use the FCB rename call.  Below is a disassembly
of a program called RENDIR.COM, which I had laying around.
Interestingly, this program will rename anything, not just directories...
Hope this helps...

---cute (sic) here---
  
PAGE  59,132
  
;[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
;[[								         [[
;[[			        RENDIR				         [[
;[[								         [[
;[[      Created:   17-Feb-87					         [[
;[[      Version:						         [[
;[[      Passes:    5	       Analysis Options on: none	         [[
;[[								         [[
;[[								         [[
;[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[
  
.err     Target	Assembler set to NONE, re-assembly not recomended
  
data_1e		equ	55h			; (8E18:0055=0)
  
seg_a		segment	byte public
		assume	cs:seg_a, ds:seg_a
  
  
		org	100h
  
rendir		proc	far
  
start:
		mov	di,data_1e		; (8E18:0055=0)
		mov	dx,di
		mov	ax,0FFh
		cld				; Clear direction
		stosw				; Store ax to es:[di]
		inc	al
		stosw				; Store ax to es:[di]
		stosw				; Store ax to es:[di]
		mov	byte ptr [di],10h
		mov	ah,17h
		int	21h			; DOS Services  ah=function 17h
						;  rename file, FCB @ ds:dx
		or	al,al			; Zero ?
		jz	loc_1			; Jump if zero
		mov	dx,offset data_2	; (8E18:0122=52h)
		mov	ah,9
		int	21h			; DOS Services  ah=function 09h
						;  display char string at ds:dx
loc_1:
		int	20h			; Program Terminate
data_2		db	'Rename error$'
		db	81 dup (1Ah)
  
rendir		endp
  
seg_a		ends
  
  
  
		end	start