|
| Charles Curley - Software Engineer, Writer | << | < | > | >> | Blog | Linked In Profile + Larger Font | - Smaller Font |
Charles Curley |
A file cleaning utility for DOS
To remove (delete) files from MS-DOS® use rms.c. The name of the program is taken from the Unix equivalent of "Delete", rm. However, rms.c works differently. The executable is available for download.
This is a sample program in C. It was originally written for Mark Williams® C on the Atari ST®, and later converted for Microsoft® C 7.0 running on MS-DOS®. It is not heavily commented. It should be written clearly enough that a programmer reasonably familiar with MS-DOS or operating systems in general can figure it out.
It is intended to work with fn.exe by piping the output of fn (or other programs) to rms. See the sample user documentation for examples of how to use these two programs.
This code is released to the public domain. Wear it in good health.
You may also download a pre-compiled Windows 95 version. This runs on NT 4 and 5, and Windows 95 and 98.
/* Deletes files indicated by stdin. After compile, save as rms.ttp begun 11 12 91 crc last modified 13 01 92 crc added ability to remove directories 8 8 92 converted to Messdos, C 7.0. 8 8 92 added line to remove read only permission before del. 1998 05 4: deletion notification strings are now the same length, so the display looks better. */ #include <stdio.h> #include <sys\types.h> #include <sys\stat.h> #include <errno.h> #include <io.h> #define SIZEOFBUFFER 1024 main() { char buf[SIZEOFBUFFER]; /* string buffer */ while(fgets(buf,SIZEOFBUFFER,stdin)) { buf[strlen(buf)-1] = 0; /* make it read & writable so we can delete it. */ chmod (buf, _S_IREAD | _S_IWRITE); if ( remove(buf) ) { if ( !rmdir(buf) ) { cputs("Removing Directory: "); cputs(buf); cputs("\n\r"); } } else { cputs("Deleting: "); cputs(buf); cputs("\n\r"); } } }
|
| << | <
| > | >> | Blog | Linked In Profile
| Welcome
| Software
| Communications
| Classes
| Resume
| Sample Code
| Thomas Jefferson: Patron Saint of the Internet
| Yum Repository Notes
| NFS and Firewalls on Fedora Core
| Netiquette
| NT Emacs Installation
| My .emacs File
| Notes on OpenSSH
| Bare Metal Recovery
| Fn
| Rms
| Dump
| Register
| Atexit
| Graphics Tree Walker
| which.nvidia
| buildiso
| Wallpaper2
| gps
| Single Source Frames
| Notes
| A Bug Notification
| Helpful Little Paperclip
| Linux on Lenovo R51
| Wyoming Travel
|