home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rexxlb.zip / SAMPLES / COPYEX.CMD < prev    next >
OS/2 REXX Batch file  |  1993-01-09  |  2KB  |  49 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* COPYEX: copy a group of files except for specified extensions. The        */
  4. /* extensions to be excluded are read from the keyboard.                     */
  5. /*                                                                           */
  6. /* Requires Personal REXX or REXXLIB (dosdir, parsefn, dosdrive, doscd       */
  7. /* dosisdir, parsefn, upper functions).                                      */
  8. /*                                                                           */
  9. /* Command format: COPYEX <from> <to>                                        */
  10. /*                                                                           */
  11. /*****************************************************************************/
  12.  
  13. signal on novalue
  14. parse arg from to .
  15. if to = '' then do
  16.     say "Format: COPYEX <from> <to>"
  17.     exit 1
  18.     end
  19. if dosdir(from) = '' then do
  20.     say "No files found matching '"from"'."
  21.     exit 2
  22.     end
  23.  
  24. /* read excluded extensions */
  25. say "Enter excluded extensions, one per line, ending with null line:"
  26. extension. = ''
  27. do forever
  28.     pull ext .
  29.     if ext = '' then
  30.         leave
  31.     extension.ext = '1'
  32.     end
  33.  
  34. /* go through list of files */
  35. parse value parsefn(from) with drive path fn ft
  36. if drive = '-' then
  37.     drive = dosdrive()
  38. if path = '-' then
  39.     path = doscd(drive)
  40. if right(path,1) \= '\' then
  41.     path = path'\'
  42. file = dosdir(from,'n')
  43. do while file \= ''
  44.     parse upper value parsefn(file) with . . . ft1
  45.     if extension.ft1 \= '1' then
  46.         'copy' drive':'path||file to
  47.     file = dosdir(,'n')
  48.     end
  49.