home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / compress / arq002.zip / ARQ.BTM next >
Text File  |  1993-07-14  |  9KB  |  301 lines

  1. @echo off
  2. setlocal
  3. echo ARQ v0.02 - multiple archiver command-line shell
  4. echo Copyright 1993 by Roger Burton-West [ubte30e@ccs.bbk.ac.uk]
  5. echo;
  6. if "%2" == "" goto parms
  7. set cmd=%@lower[%1]
  8. set archive=%@full[%2]
  9. set files=%3
  10. set type=%@upper[%@ext[%2]]
  11. if "%files" == "" set files=*.*
  12. if "%type" == "" set type=ARJ
  13. for %a in (a m x d l v t c s s1) if %a == %cmd goto goodcmd
  14. goto badcmd
  15.  
  16. :goodcmd
  17. for %a in (ARJ ZIP ARC LZH PAK ZOO HYP DWC LZS HPK HA AR MD SQZ LBR HAP) if %a == %type goto goodarc
  18. goto badarc
  19.  
  20. :goodarc
  21.  
  22. iff "%type" == "ARJ" then
  23. if %cmd == a ARJ a -a+ -e1 -m1+ -r+ -y+ -jt+ -jg+ -jm %archive %files
  24. if %cmd == m ARJ m -a+ -e1 -m1+ -r+ -y+ -jt+ -jg+ -jm %archive %files
  25. if %cmd == x ARJ x -y+ -jg+ %archive %files
  26. if %cmd == d ARJ d -y+ %archive %files
  27. if %cmd == l ARJ l %archive %files
  28. if %cmd == v ARJ v -jv1 %archive %files
  29. if %cmd == t arj t %archive %files
  30. if %cmd == c arj c -z%files %archive
  31. if %cmd == s arj y -je %archive
  32. if %cmd == s1 arj y -je1 %archive
  33. goto endok
  34. endiff
  35.  
  36. iff "%type" == "ZIP" then
  37. if %cmd == a PKZIP -a -r -p -q -ex -wHS %archive %files
  38. if %cmd == m PKZIP -m -a -r -p -q -ex -wHS %archive %files
  39. if %cmd == x PKUNZIP -d %archive %files
  40. if %cmd == d PKZIP -d %archive %files
  41. if %cmd == l pkunzip -vb %archive %files
  42. if %cmd == v pkunzip -vm %archive %files
  43. if %cmd == t pkunzip -t %archive %files
  44. if %cmd == c pkzip %archive -z -q <%files
  45. if %cmd == s zip2exe %archive
  46. if %cmd == s1 zip2exe -j %archive
  47. goto endok
  48. endiff
  49.  
  50. iff "%type" == "ARC" then
  51. if %cmd == a ARC a %archive %files
  52. if %cmd == m ARC m %archive %files
  53. if %cmd == x ARC x %archive %files
  54. if %cmd == d ARC d %archive %files
  55. if %cmd == l ARC l %archive %files
  56. if %cmd == v ARC v %archive %files
  57. if %cmd == t ARC t %archive %files
  58. if %cmd == c goto nocomm
  59. if %cmd == s mksarc %@name[%archive]
  60. if %cmd == s1 mksarc %@name[%archive]
  61. goto endok
  62. endiff
  63.  
  64. iff "%type" == "LZH" then
  65. if %cmd == a LHA a /a+ /r+ /x+ %archive %files
  66. if %cmd == m LHA m /a+ /r+ /x+ %archive %files
  67. if %cmd == x LHA x /a+ %archive %files
  68. if %cmd == d LHA d /a+ %archive %files
  69. if %cmd == l LHA l /a+ %archive %files
  70. if %cmd == v LHA v /a+ %archive %files
  71. if %cmd == t LHA t /a+ %archive %files
  72. if %cmd == c goto nocomm
  73. if %cmd == s LHA s -x1 %archive
  74. if %cmd == s1 LHA s -x0 %archive
  75. goto endok
  76. endiff
  77.  
  78. iff "%type" == "PAK" then
  79. if %cmd == a PAK a /I %archive %files
  80. if %cmd == m PAK m /I %archive %files
  81. if %cmd == x PAK e /path %archive %files
  82. if %cmd == d PAK d /path %archive %files
  83. if %cmd == l pak l %archive %files
  84. if %cmd == v pak v /path %archive %files
  85. if %cmd == t pak t %archive %files
  86. if %cmd == c goto nocomm
  87. if %cmd == s PAK c /exe %archive
  88. if %cmd == s1 PAK c /exe %archive
  89. goto endok
  90. endiff
  91.  
  92. iff "%type" == "ZOO" then
  93. if %cmd == a STUFF %files | ZOO aIh %archive
  94. if %cmd == m (STUFF %files | ZOO aIh %archive ^ gosub dodel)
  95. if %cmd == x ZOO x.// %archive %files
  96. if %cmd == d ZOO DP %archive %files
  97. if %cmd == l zoo l %archive %files
  98. if %cmd == v zoo lVC %archive %files
  99. if %cmd == t zoo xND %archive %files
  100. if %cmd == c goto nocomm
  101. if %cmd == s sez %@name[%archive] %@name[%archive]
  102. if %cmd == s1 sez %@name[%archive] %@name[%archive]
  103. goto endok
  104. endiff
  105.  
  106. iff "%type" == "HYP" then
  107. if %cmd == a HYPER -a -r -p %archive %files
  108. if %cmd == m HYPER -m -r -p %archive %files
  109. if %cmd == x HYPER -x -p %archive %files
  110. if %cmd == d HYPER -d %archive %files
  111. if %cmd == l hyper -v %archive %files
  112. if %cmd == v hyper -v %archive %files
  113. if %cmd == t goto notest
  114. if %cmd == c goto nocomm
  115. if %cmd == s Copy /b Hyper.EXE+%archive %@name[%archive].EXE
  116. if %cmd == s1 Copy /b Hyper.EXE+%archive %@name[%archive].EXE
  117. goto endok
  118. endiff
  119.  
  120. iff "%type" == "DWC" then
  121. if %cmd == a DWC a %archive %files
  122. if %cmd == m DWC m %archive %files
  123. if %cmd == x DWC e %archive %files
  124. if %cmd == d DWC d %archive %files
  125. if %cmd == l dwc l %archive %files
  126. if %cmd == v dwc v %archive %files
  127. if %cmd == t dwc t %archive %files
  128. if %cmd == c goto nocomm
  129. if %cmd == s goto nosfx
  130. if %cmd == s1 goto nosfx
  131. goto endok
  132. endiff
  133.  
  134. iff "%type" == "LZS" then
  135. if %cmd == a LARC a /r %archive %files
  136. if %cmd == m (LARC a /r %archive %files ^ gosub dodel)
  137. if %cmd == x LARC e /x %archive %files
  138. if %cmd == d LARC d %archive %files
  139. if %cmd == l larc l %archive %files
  140. if %cmd == v larc l %archive %files
  141. if %cmd == t goto notest
  142. if %cmd == c goto nocomm
  143. if %cmd == s larc s %archive
  144. if %cmd == s1 larc s %archive
  145. goto endok
  146. endiff
  147.  
  148. iff "%type" == "HPK" then
  149. if %cmd == a HPACK a -r -da -a %archive %files
  150. if %cmd == m HPACK a -f -r -da -a %archive %files
  151. if %cmd == x HPACK x -da -r %archive %files
  152. if %cmd == d HPACK D %archive %files
  153. if %cmd == l hpack v -vf %archive %files
  154. if %cmd == v hpack v %archive %files
  155. if %cmd == t hpack t %archive %files
  156. if %cmd == c hpack a -wa %archive %files
  157. if %cmd == s goto nosfx
  158. if %cmd == s1 goto nosfx
  159. goto endok
  160. endiff
  161.  
  162. iff "%type" == "HA" then
  163. if %cmd == a HA a21ra %archive %files
  164. if %cmd == m HA a21ram %archive %files
  165. if %cmd == x HA xya %archive %files
  166. if %cmd == d HA d %archive %files
  167. if %cmd == l ha l %archive %files
  168. if %cmd == v ha lf %archive %files
  169. if %cmd == t ha t %archive %files
  170. if %cmd == c goto nocomm
  171. if %cmd == s goto nosfx
  172. if %cmd == s1 goto nosfx
  173. goto endok
  174. endiff
  175.  
  176. iff "%type" == "AR" then
  177. if %cmd == a for %%qux in (%files) ar a %archive %%qux
  178. if %cmd == m (for %%qux in (%files) ar a %archive %%qux^gosub dodel)
  179. if %cmd == x ar x %archive %files
  180. if %cmd == d ar d %archive %files
  181. if %cmd == l ar l %archive %files
  182. if %cmd == v ar l %archive %files
  183. if %cmd == t goto notest
  184. if %cmd == c goto nocomm
  185. if %cmd == s goto nosfx
  186. if %cmd == s1 goto nosfx
  187. goto endok
  188. endiff
  189.  
  190. iff "%type" == "MD" then
  191. if %cmd == a mdcd c %files %archive
  192. if %cmd == m (mdcd c %files %archive^gosub dodel)
  193. if %cmd == x mdcd d %archive
  194. if %cmd == d goto nodel
  195. if %cmd == l mdcd l %archive %files
  196. if %cmd == v mdcd f %archive %files
  197. if %cmd == t goto notest
  198. if %cmd == c goto nocomm
  199. if %cmd == s goto nosfx
  200. if %cmd == s1 goto nosfx
  201. goto endok
  202. endiff
  203.  
  204. iff "%type" == "SQZ" then
  205. if %cmd == a sqz a %archive /WSp0q0a?=z1 %files
  206. if %cmd == m sqz am %archive /WSp0q0a?=z1 %files
  207. if %cmd == x sqz x %archive /z1 %files
  208. if %cmd == d sqz d %archive %files
  209. if %cmd == l sqz l %archive %files
  210. if %cmd == v sqz v %archive %files
  211. if %cmd == t sqz t %archive %files
  212. if %cmd == c sqz c %archive %files
  213. if %cmd == s sqz s %archive
  214. if %cmd == s1 sqz s /z2 %archive
  215. goto endok
  216. endiff
  217.  
  218. iff "%type" == "LBR" then
  219. if %cmd == a luu %archive %files /n
  220. if %cmd == m (luu %archive %files /n^gosub dodel)
  221. if %cmd == x lue %archive %files
  222. if %cmd == d lud %archive %files
  223. if %cmd == l lut %archive %files
  224. if %cmd == v lut %archive %files
  225. if %cmd == t goto notest
  226. if %cmd == c goto nocomm
  227. if %cmd == s goto nosfx
  228. if %cmd == s1 goto nosfx
  229. goto endok
  230. endiff
  231.  
  232. iff "%type" == "HAP" then
  233. if %cmd == a hap a %archive %files
  234. if %cmd == m (hap a %archive %files^gosub dodel)
  235. if %cmd == x pah e %archive %files
  236. if %cmd == d pah d %archive %files
  237. if %cmd == l hap l %archive %files
  238. if %cmd == v hap l %archive %files
  239. if %cmd == t goto notest
  240. if %cmd == c goto nocomm
  241. if %cmd == s goto nosfx
  242. if %cmd == s1 goto nosfx
  243. goto endok
  244. endiff
  245.  
  246. :parms
  247. echo Too few parameters.
  248. goto syntax
  249.  
  250. :badcmd
  251. echo Invalid command: only a, m, x, d, l, v, t, c, s, s1
  252. goto syntax
  253.  
  254. :syntax
  255. echo syntax: ARQ command archive [filespec]
  256. echo where command is one of:
  257. echo a : add files to archive (recurse subdirs if available)
  258. echo m : move files to archive (add only if move not available)
  259. echo x : extract files from archive
  260. echo d : delete files from archive
  261. echo l : brief listing of archive
  262. echo v : verbose listing of archive
  263. echo t : test archive
  264. echo c : add comment file to archive
  265. echo s : make self-extractor (s1 for small SFX)
  266. goto end
  267.  
  268. :badarc
  269. echo %type files are an invalid archive type (not supported).
  270. goto end
  271.  
  272. :notest
  273. echo Sorry, cannot test archives of type %type.  Try extracting instead.
  274. goto end
  275.  
  276. :nodel
  277. echo Sorry, cannot delete files in type %type archive.  Try rebuilding instead.
  278. goto end
  279.  
  280. :nocomm
  281. echo Sorry, archive comments are not available for type %type archives.
  282. goto end
  283.  
  284. :nosfx
  285. echo Sorry, self-extraction is not available for type %type archives.
  286. goto end
  287.  
  288. :dodel
  289. if %? NE 0 return
  290. if exist %files del /sy %files >nul
  291. return
  292.  
  293. :endok
  294. iff %? == 0 then
  295. echo Command completed.
  296. else
  297. echo Problem with command: error code %?.
  298. endiff
  299. :end
  300. endlocal
  301.