home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / BATUTL / BAT204C.ZIP / HCOPY.BAT < prev    next >
Encoding:
DOS Batch File  |  1986-01-13  |  4.5 KB  |  152 lines

  1.  
  2. bat *
  3. bat *            The file HCOPY.BAT
  4. bat *            ==================
  5.  
  6. bat * Selective copying of files - Command: HCOPY <wildcard spec>
  7.  
  8. bat * also a demonstration of the READSCRN command for 80 col display
  9.  
  10. bat * Written 1/25/83
  11. bat * Copyright 1983 by Frank Canova and Seaware Corp.
  12. bat * Extensions 6/28/84 by Egin Muth
  13. bat *          For DOS 2.0 and hard disk systems
  14. bat *          Improved error handling
  15. bat *          Command may be issued with parm (filespec)
  16. bat *          Handles the funny dots in DOS 2.0 directory
  17. bat *          Prettied up screen presentation
  18. bat *          May quit during query
  19. bat *          May cancel copy operation
  20. bat *          Copy from A: to A: via hard disk subdirectory C:\KOPY
  21. bat *
  22.  
  23. bat if %1 = A2A GOTO -A2A
  24. echo off
  25. bat cls
  26. bat if .%1 <> .  type | GOTO -rd.1
  27. bat begtype
  28.  
  29.             Selective file copying (including from A: to A:)
  30.  
  31.             First give a global filespec (e.g.: *.BAS)
  32.  
  33.             Then choose one by one:  Y=yes  N=no  Q=quit
  34.  
  35.  
  36.  
  37. end
  38. bat * Make sure that we know where data is traveling from/to
  39. bat     READ Enter a wild card spec , or press enter for all files %1
  40. bat     TYPE
  41. bat -rd.1 INKEY Which drive is the "from" diskette? (A, B, C, or D) %4
  42. bat     CALL -check | %2 = %4: | IF .%4 = . GOTO -rd.1
  43. bat     TYPE
  44. bat -rd.2 INKEY Which drive is the "to"   diskette? (A, B, C, or D) %4
  45. bat     CALL -check | %3 = %4: | IF .%4 = . GOTO -rd.2
  46. bat     IF %2 <> a: IF %3 = %2 call -errmsg | GOTO -rd.1
  47. bat     %O = 0
  48. bat     If %3 = %2 %O = A2A | %3 = c:\kopy | * copy from A to A via hard disk
  49. bat * Get a directory of "from" to start asking questions about.
  50. bat     CLS
  51. DIR     %2%1/w
  52. bat
  53. bat     STACK.ON        | * Make sure another program didn't set this off
  54. bat     * Start reading from bottom of screen, skip all blank lines
  55. bat -ignore READSCRN %k | if .%k = . goto -ignore
  56.  
  57.  
  58. bat * Verify that have something to copy.
  59. bat     IF %K = file type no files are available to copy | exit
  60. bat     IF %K = 0 type no files are available to copy | exit
  61.  
  62. bat     %L = y | %M = %S%S%S%S%S%S%S
  63.  
  64. bat * Get upto 5 file names on each line.
  65. bat -read.dline READSCRN %A %B %C %D %E %F %G %H %I %J
  66. bat     IF %R = 4 GOTO -query   | * Directory header above line 4, ignore
  67.  
  68.  
  69. bat * Save on the keyboard stack all the file names if they exist.
  70. bat     IF %A = . %K = %K - 2 | skip 1
  71. bat     IF .%A <> . STACK %A .%B
  72. bat     IF .%C <> . STACK %C .%D
  73. bat     IF .%E <> . STACK %E .%F
  74. bat     IF .%G <> . STACK %G .%H
  75. bat     IF .%I <> . STACK %I .%J
  76. bat     GOTO -read.dline
  77.  
  78.  
  79. bat -query  CLS
  80. bat     TYPE
  81. bat     TYPE %k files found for copy from %2 to %3
  82. bat     TYPE
  83. bat -q.loop READ %A %B          |* Read file name off of stack
  84. bat     %C = %A%M $ 1 8 | %F = %C%B
  85. bat     IF %L = n goto -q.loop.n
  86. bat     if %K < 10 %k = 0%k
  87. bat -q.loop2 TYPE %S%S%k %S%S Copy %S%S%S %F %S%S (Y, N, Q) ?%S  ;
  88. bat     INKEY %C                |* Does user want to copy this one?
  89. bat     IF %C = y TYPE Yes  | SKIP 3
  90. bat     IF %C = n TYPE No   | SKIP 3
  91. bat     IF %C = q TYPE Quit | %L = n | GOTO -q.loop.n
  92. bat     BEEP GOTO -q.loop2
  93. bat -q.loop.y STACK copy %2%A%B %3 | * Stack the copy command
  94. bat -q.loop.n  %k = %K - 1
  95. bat     IF %K <> 0 GOTO -q.loop
  96.  
  97. bat * Remove any other messages that DOS might have put on the directory
  98. bat * which might have gotten stacked during the READSCRN above.
  99. bat -clean.stack
  100. bat     IF %q = k skip 3
  101. bat     READ %A %B %C
  102. bat     IF %A <> copy GOTO -clean.stack
  103. bat     STACK %A %B %C
  104.  
  105.  
  106. bat * check whether copy is from A to A, i.e. via hard disk \kopy
  107. bat     IF %O = A2A  STACK vcopy A2A
  108.  
  109. bat * Verify that user is ready. DOS will pull the copy commands off of the
  110. bat * keyboard stack after the EXIT
  111. bat -prompt BEEP
  112. bat     TYPE
  113. bat     INKEY Ready to copy - Press any key - Q to cancel . . . %a
  114. bat     CLS
  115. bat     TYPE
  116. bat     IF %a = q stack.purge | type copying cancelled
  117. bat     EXIT
  118.  
  119. bat -A2A CLSP
  120. bat      BEGTYPE
  121.  
  122.  
  123.            Insert copy-to diskette in drive A, then press any key . . .
  124.  
  125.  
  126. end
  127. bat     BEEP
  128. bat     INKEY
  129. bat     STACK Y
  130. COPY c:\kopy\*.* a:
  131. DEL  c:\kopy\*.*
  132. bat   EXIT
  133.  
  134.  
  135. bat * This is a subroutine which checks the drive spec for validity.
  136. bat -check
  137. bat     %5 = %4 # | IF %5 = 1 TYPE %4
  138. bat     IF %4 = A SKIP 4
  139. bat     IF %4 = B SKIP 3
  140. bat     IF %4 = C SKIP 2
  141. bat     IF %4 = D SKIP 1
  142. bat     %4 = | call -errmsg
  143. bat -chk.ok RETURN
  144.  
  145. bat -errmsg
  146. bat beep
  147. bat begtype
  148.       >>>  Bad drivespec - try again
  149.  
  150. end
  151. bat RETURN
  152.