home *** CD-ROM | disk | FTP | other *** search
- ;**********************************************************************
- ; Super-simple file deleter that completely erases file !
- ; Free utility from David Smith, Compuserve 71441,2723
- ; Any comments, suggestions ... write me.
- ;**********************************************************************
-
- DOSSEG
- MODEL small
- STACK 256
-
- DATASEG
-
- helping db 'Usage: BYE [filename] ',0
- hand db 'Free utility from Dave Smith, Compuserve [71441,2723]',0
- msg db 'Error deleting the file ',0
-
- CODESEG
-
- EXTRN getparams:proc, getoneparam:proc, strwrite:proc, byebye:proc
- EXTRN paramcount:proc, newline:proc
-
- Start:
- mov ax, @data ;move variables into AX
- mov es, ax ;and that into ES
- call getparams ;External function to get
- call paramcount ;command-line parameters
- or dx, dx ;See if parameters exist
- jz help ;If not, show help screen
-
- xor cx, cx ;Clear out CX
- call getoneparam ;get first parameter
- mov dx, di ;move name into DX
- mov ah, 3Ch ;CREATE file function
- mov cx, 06h ;make Hidden + System
- int 21h ;call DOS
- jc error
-
- mov bx, ax ;move file handle to BX
- mov ah, 57h ;set-up for file date/time change
- mov al, 01h
- mov cx, 00h ;time == 0
- mov dx, 00h ;date == 0
- int 21h ;call DOS
- jc error
-
- mov dx, di ;set-up for deleting file
- mov ah, 41h
- int 21h ;and DOS it !
- jc error
- call byebye ;Then exit via external function
-
- help: call newline ;external function to make newline
- mov di, offset helping ;Pull helpscreen in
- call strwrite
- call newline
- mov di, offset hand
- call strwrite ;and write it
- call newline ; Another newline, then leave
- call byebye
- error:
- mov di, offset msg ;Show error message
- call strwrite
- call byebye ;Then leave
-
- END start