home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / wuz131.zip / Zip-Dir.Tpl < prev    next >
Text File  |  1994-05-21  |  2KB  |  66 lines

  1. /* Move entire folder into a ZIP file of the same name */
  2. /* (c) Copyright 1993 Scott Maxwell.*/
  3.  
  4. IconPath = 'E:\My_OS2\'
  5. UsePKZip = 1
  6.  
  7. parse arg Name
  8.  
  9. OriginalName = Name
  10.  
  11. if Name = '' then do
  12. Usage:
  13.   say "USAGE: Zip-Dir directory-name"
  14.   say "  Moves the contents of the specified directory into a ZIF file in"
  15.   say "  the same directory.  The purpose of this command is to compress"
  16.   say "  entire directories that you are not currently using.  To restore"
  17.   say "  the directory, simply double-click on the ZIF file or drag-and-"
  18.   say "  drop the ZIF file or the directory onto your WPS Unzip icon."
  19.   '@pause'
  20.   exit(0)
  21.   end
  22.  
  23. Dir.1 = DIRECTORY()
  24. Dir.2 = ''
  25. if SubStr(Name,2,1) = ':' then do
  26.   Dir.2 = DIRECTORY(Left(Name,2))
  27.   Name = SubStr(Name,3)
  28.   end
  29.  
  30. Name = Directory(Name)
  31. if Name = '' then do
  32.   say "Can't find a directory called" OriginalName
  33.   signal Usage
  34. end
  35.  
  36. fName = FILESPEC('Name', Name)
  37.  
  38. Say "Moving" Name "directory ->" Name"\"fName".Zif"
  39. Say "Use 'WUZ" Name"' to restore or double click on" fName".Zif"
  40.  
  41. '@ren "'fName'.Zif" "'fName'.Zip" 2> nul > nul'
  42. if UsePKZip = 1 then
  43.    '@pkzip -p -r -m -u "'fName'" *'
  44. else
  45.    '@zip -r -m -u "'fName'" *'
  46. '@ren "'fName'.zip" "'fName'.zif" > nul'
  47. call RxFuncAdd 'SysSetObjectData','RexxUtil','SysSetObjectData'
  48. Call SysSetObjectData Name,"ICONFILE="IconPath"FldZip.Ico"
  49.  
  50. if Dir.2 \= '' then call Directory(Dir.2)
  51. call Directory(Dir.1)
  52.  
  53.  
  54. exit(0)
  55.  
  56.  
  57. Directory: procedure
  58.   arg Name
  59.   Name = Strip(Name,,'"')
  60.   if Length(Name) > 3 then
  61.     if Right(Name,1) = '\' then
  62.       Name = Left(Name,LENGTH(Name)-1)
  63.  
  64.   n = 'DIRECTORY'(Name)
  65. return n
  66.