Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxlm.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!whuxlm!jph From: jph@whuxlm.UUCP (Holtman Jim) Newsgroups: net.micro.pc Subject: Re: directory renaming utility Message-ID: <720@whuxlm.UUCP> Date: Sat, 30-Mar-85 10:49:52 EST Article-I.D.: whuxlm.720 Posted: Sat Mar 30 10:49:52 1985 Date-Received: Sun, 31-Mar-85 03:35:39 EST References: <477@lll-crg.UUCP> <1200009@ur-univax.UUCP> Organization: AT&T Bell Laboratories, Whippany Lines: 77 > I just downloaded a version of RENDIR from Compuserve. It is in the IBM PC > Novice SIG in DL1 - Utilities. I'm not sure its the most up to date version. > You can't type the to and from names on the command line - you must wait until > prompted. Also, it doesn't seem to like paths - you must be 1 level up from > the directory you want to rename. Even with these inconveniences, it is a > very useful utility. > > If anyone knows of a version without these restrictions, please post the info > as a response to this note. Thanks. > > Mark J. Dumic > University of Rochester Computing Center > ...{seismo|decvax|allegra}!rochester!ur-univax!marc For those of you who have TURBO PASCAL (and everyone should since it is really great), here is a utility for renaming files, including directories. ---------------cut here----------------- program rename; {rename files or directories} type regset = record case integer of 1: ( ax,bx,cx,dx,bp,si,di,ds,es,flags : integer); 2: ( al,ah,bl,bh,cl,ch,dl,dh : byte); end; var params : regset; fcb : array[-7..37] of byte; {Extended FCB} file_name : string[20]; i : integer; begin fcb[-7] := $FF; {setup Extended FCB} fcb[-1] := $16; {match on anything} with params do begin write('Old File Name: '); readln(file_name); file_name := file_name + ' '; {terminate to stop parse} ax := $2901; {parse the filename} ds := seg(file_name[1]); si := ofs(file_name[1]); es := seg(fcb[0]); di := ofs(fcb[0]); msdos(params); if al <> 0 then begin writeln(^G'invalid file name'); halt; end; write('New File Name: '); readln(file_name); file_name := file_name + ' '; ax := $2903; {parse the file name} ds := seg(file_name[1]); si := ofs(file_name[1]); es := seg(fcb[$10]); di := ofs(fcb[$10]); msdos(params); if al <> 0 then begin writeln(^G'invalid file name'); halt; end; ah := $17; {rename call} ds := seg(fcb[-7]); {use the Extended FCB} dx := ofs(fcb[-7]); msdos(params); if al <> 0 then writeln(^G'Rename Unsuccessful!!') else writeln('Done'); end; end.