25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music

Use Microsoft MBASIC to rename any file in CP/M

Under some circumstances, it was possible in the CP/M operating system to accidentally create disk files with names that CP/M itself could not recognize. Example: file names containing lowercase characters. Only upper case was allowed. It was impossible to use CP/M commands to rename or even delete these files.   

Microsoft MBASIC, however, could deal with these file names, so you could rename or delete them from within an MBASIC utility program such as this one.  

RENAME.BAS

10 'RENAME.BAS 
11 'COPYRIGHT (C)1982 STEVEN WHITNEY.    
12 'Published under GNU GPL (General Public License) Version 3, with ABSOLUTELY NO WARRANTY.
13 'Initially published by http://25yearsofprogramming.com.
14 'IT IS POSSIBLE IN MBASIC TO CREATE A DISK FILE WITH A NAME THAT IS ILLEGAL
15 'UNDER CP/M, USUALLY BECAUSE IT CONTAINS LOWERCASE CHARACTERS.
16 'CP/M CANNOT ACCESS OR EVEN DELETE THE FILE BECAUSE IT DOESN'T ACKNOWLEDGE ITS EXISTENCE.
17 'THIS PROGRAM ALLOWS YOU TO RENAME ANY FILE ON YOUR DISK, EVEN ONE WITH AN ILLEGAL NAME.
20 ON ERROR GOTO 130
30 PRINT CHR$(27)"E";"This program will allow you to rename ANY file on your disk.":PRINT
40 PRINT "Please remember to precede your filename by a disk drive designation."
50 PRINT "Also, you MUST use CAPITAL letters for the new file name,"
60 PRINT "or else the name will remain illegal!":PRINT
70 INPUT "WHAT IS THE CURRENT NAME OF THE FILE?";A$
80 INPUT "WHAT SHOULD THE NEW NAME BE?";B$
90 NAME A$ AS B$
100 INPUT "ARE YOU THROUGH (Y/N)?";Z$
110 IF Z$="Y" OR Z$="y" THEN SYSTEM ELSE RUN
120 END
130 PRINT "FILE PROBABLY TYPED WRONG.  PLEASE TRY AGAIN BY TYPING 'RUN'"
140 END

 

Valid HTML 4.01 Transitional Valid CSS
Yahoo! Search
Search the web Search this site
View content labeling at ICRA.