home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol144 / rename.doc < prev    next >
Encoding:
Text File  |  1985-02-10  |  3.3 KB  |  100 lines

  1. FILES NEEDED:
  2.         rename.c
  3.         rename.doc
  4.         bdos.h
  5.  
  6. Compiled under BDS C 1.5A and is known not to work reliably with 1.46.
  7.  
  8.  
  9. ------------------------------------------------------------------------
  10.  
  11.  
  12. This program allows wildcard renaming of files
  13.  
  14.          Usage: rename new_afn old_afn
  15.  
  16. e.g.     rename *.asm *.mac
  17.                    change all .MAC to .ASM
  18.  
  19.          rename b:fred.* b:joe.*
  20.                    change JOE's files into FRED's on drive B
  21.  
  22.          rename 4/???1-1.* 4/???1-2.*
  23.                    change version number of ??? on user 4
  24.  
  25.          rename 18/d:*.sav 18/d:*.$$$
  26.                    hang on to temp files in .SAV files on
  27.                    drive D user level 18
  28.  
  29. Formally, the file names are of form:
  30.  
  31.         [user#/][drive:]ambiguous.ambiguous
  32.  
  33. This can lead to some constructs that are meaningless. My definition
  34. of a "reasonable" ambiguous reference is as follows:
  35.  
  36.     For any character position in the name,
  37.         1) You CANNOT change from unambiguous to ambiguous. This
  38.               would imply generating HEAPS of files with different
  39.               names to satisfy the reference.
  40.  
  41.         2) You can change from ambiguous to unambiguous, in
  42.               which case the unambiguous character is in the
  43.               output name.
  44.  
  45.         3) You can change from ambiguous to ambiguous, where
  46.               the output character is the character in the
  47.               current input file name.
  48.  
  49.         4) You can change from unambiguous to unambiguous. The
  50.               characters are just substituted.
  51.  
  52. These definitions were cooked up as I wrote the program. My
  53. logic says that they are correct, but then Version 1 did not
  54. work, so there you go....
  55. รจ
  56. If you try to rename to an existing name, the program asks
  57. you what to do:
  58.  
  59.     e.g. drive F, user 8 contains the files
  60.                         FRED.ASM
  61.                         FRED.MAC
  62.                         JOE.MAC
  63.         If we enter "rename 8/f:joe.*   8/f:fred.*", then
  64.         the problem arises of JOE.MAC -> FRED.MAC
  65.  
  66. If this happens , there are 3 options:
  67.         (Q)uit : quit program. These will leave all
  68.                  files so far renamed. The files are renamed
  69.                  on a first-come first-served basis in the
  70.                  directory entries, so who knows what will
  71.                  be renamed...
  72.  
  73.         (S)kip : skip this rename. Rename all the files that
  74.                  match except this one.
  75.  
  76.         (K)ill : kill the output file-name. Deletes the destination
  77.                  file, and then continues renaming.
  78.  
  79.  
  80.  
  81. The programs builds 3 lists in memory before starting to rename
  82. things:
  83.  
  84.    List 1   Original name
  85.    List 2   New name
  86.    List 3   All files on disk
  87.  
  88. This makes it a memory hog, but it does work a bit faster.
  89. Note that will need (3*30*dir_entries) bytes of free space
  90. in the worst case.  e.g. for 128 entries 'bout 12k
  91.  
  92. DAVID BROWN    (SYDNEY (02) 387-6539 for complaints)
  93.  
  94. P.S. On my keyboard I can't type the OR and bitwise-OR char
  95.      thus I use the #defines in BDSCIO.H:
  96.  
  97.                 #define OR  (2 chars) /* logical */
  98.                 #define BOR (1 chars) /* bitwise */
  99.  
  100.