home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / perf31.zip / perf_30 / MMD.CMD < prev    next >
OS/2 REXX Batch file  |  1994-01-06  |  3KB  |  75 lines

  1. /* Make Multiple Directories*/
  2. /*Copyright (c) 1993 CLEAR & SIMPLE, INC.*/
  3. ECHO OFF
  4. arg directory cmd
  5. if directory='' then do
  6. echo on
  7. 'prompt $p$E[0;'34';'47';'4';'4'm]'
  8. echo off
  9. 'cls'
  10. red        ='A'
  11. green      ='A'
  12. yellow     ='A'
  13. blue       ='A'
  14. white      ='A'
  15. say 'MMD (Make Multiple Directory) was written to be executed from the command line.'
  16. say;say '   Its format is:  MMD d:\dir\sub1\sub2 [Y]  '
  17. say '   Where d:\dir\sub1\sub2 is the fully qualified directory path to be created';
  18.  
  19. say '   And Y is an option to create the directory without any dialog. '
  20. say    ''
  21. say;say 'Enter fully qualified directory now?'
  22. pull directory
  23. if directory ='' then Exit
  24. Say; say 'Do you want MMD to skip dialog during creation?'
  25. say 'Enter Y for yes (any other key will answer no)'
  26. parse upper value sysgetkey()with cmd;say
  27. end
  28.  
  29. parse upper var cmd cmd
  30. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  31. call SysLoadFuncs
  32. pos=pos('"', directory)
  33. If pos\=0 then directory=strip(directory,'B','"')
  34. pos=pos("'", directory)
  35. If pos\=0 then directory=strip(directory,'B',"'")
  36. parse var directory drive '\' s.1 '\' s.2 '\' s.3 '\' s.4 '\' s.5 '\' s.6 '\' s.7 '\' s.8 '\' s.9 '\' s.10 '\' s.11 '\' s.12 '\' s.13 '\' s.14 '\' s.15 '\' s.16 '\' s.17 '\' s.18 '\' s.19 '\' s.20
  37. madenew=0
  38. i=1
  39. newdir=drive
  40. do while s.i \=''
  41.    newdir=newdir'\'s.i
  42. rc=SysFileTree(newdir,dest,'DO');
  43. if dest.0=0 then do /*make a new directory*/
  44.  if cmd \= 'Y' then do
  45.    say 'The path 'newdir 'does not exist'
  46.    say 'Do you want the path created?'
  47.    Say 'Answer Y to continue.'
  48.    parse upper value sysgetkey() with answ;say
  49.    if answ \= 'Y' then exit
  50.   end
  51.    madenew=1
  52.    rc=SysMkDir(newdir)
  53.   Select
  54.       when rc=3 then do;call notsound;say 'Incorrect Format';call sayend;exit;end
  55.       when rc=5 then do;call notsound;say 'Access is denied to drive or path';
  56.          say 'Please free resource and try again';call sayend;exit;end
  57.       when rc=206 then do;call notsound;say 'Directory name is too long';
  58.          say 'Shorten name - 'newdir; say '  or use an HPFS Drive'; call sayend;exit;end
  59.       when rc\=0 then do; call notsound; say 'Error making directory - please retry'; call sayend;exit; end
  60.    otherwise;
  61.    end
  62.  end /*make a new directory*/
  63. i=i+1
  64. end
  65. if cmd \= 'Y' then do
  66. if madenew then say 'Made the new directory structure' newdir
  67. else say 'The directory structure' newdir 'already existed!'
  68. end
  69. return madenew
  70. sayend: say;say 'Press any key to end...';key=sysgetkey();return
  71. notsound:
  72.      call beep 262,200
  73.      call beep 60,700
  74. return
  75.