home *** CD-ROM | disk | FTP | other *** search
- #Script Archive files (v0.04)
- #
- # This script provides an easy to use frontend for three popular
- # CLI archiving utilities (ARC, LHarc, and Tar) which you must have
- # installed in your current Library directory. In all cases it will
- # cause a new archive to be created and the specified files to be
- # added to it.
- #
- #Menu Archiver:arc,lharc,tar|compress\tar,zip
- #Arg Send to:
- #Width 10
- #Arg Archive name:
- #Width 40,80
- #Arg Filenames:
- #Args
- #
- # First, some range checking...
- #
- #if "%2%"=""
- #error You must specify an archive name to create!
- #endif
- #if "%3%"=""
- #error You must specify at least one file to archive!
- #endif
- #
- # Now initialise variables
- #
- #os Dir <ReadNews$TempDir>
- #if "<tar$scrap>"=""
- #os set tar$scrap <ReadNews$TempDir>.TarScrap
- #endif
- #os set Alias$Archiving %0% m %2%
- #
- # If we are zipping, change the command slightly
- #
- #if "%0%"="zip"
- #os set Alias$Archiving zip -rm %2%
- #os cdir %2%
- #endif
- #
- # If we are tarring, create a blank tarchive now...
- #
- #if "%0%"="tar"
- #task tar cf %2% null:
- #endif
- #
- # Copy all files into temp directory
- # - If tarring, archive them and delete them as well
- # as Tar has no MOVE option.
- #
- #repeat
- #os set leaf ""
- #os set branch "%3%"
- #while (branch RIGHT 1 <> ".") AND LEN branch > 0
- #os seteval leaf (branch RIGHT 1)+leaf
- #os seteval branch (branch LEFT (LEN branch - 1))
- #endwhile
- #task copy %3% <leaf> ~cq~v
- #if "%0%"="tar"
- #os set Alias$Archiving tar rf %2% <leaf>
- #task Archiving
- #os remove <leaf>
- #else
- #os set Alias$Archiving <Alias$Archiving> <leaf>
- #endif
- #Shift 3
- #until "%3%"=""
- #
- # Archive them all if we are not tarring
- #
- #if "%0%"<>"tar"
- #task Archiving
- #endif
- #os unset Alias$Archiving
- #
- # Process archive name to make it uniform
- # - ARC leaves filename unchanged
- # - LHarc adds "_lzh" to end and truncates to 10 chars
- # - Tar needs compressing, which truncates name to 8 chars and
- # appends "-Z"
- #
- #os set leaf "%2%"
- #
- # LHarc code
- #
- #if "%0%"="lharc"
- #os seteval leaf (leaf + "_lzh") LEFT 10
- #endif
- #
- # zip code
- #
- #if "%0%"="zip"
- #os rename <leaf> _!!_!!_
- #os rename _!!_!!_.zip <leaf>
- #os delete _!!_!!_
- #endif
- #
- # Set the type of the file to Archive (strange!)
- #
- #os SetType <leaf> DDC
- #
- # Tar code
- #
- #if "%0%"="tar"
- #os seteval newleaf leaf LEFT 8
- #os rename <leaf> <newleaf>
- #os set leaf <newleaf>
- #os set Alias$Compressing compress <newleaf>
- #task Compressing
- #os unset Alias$Compressing
- #os seteval leaf (newleaf + "-Z") LEFT 10
- #os SetType <leaf> FFD
- #endif
- #
- # If an email address was not given, open the temp directory.
- # Otherwise UUencode and email the file, deleting it afterwards.
- #
- #if "%1%"=""
- #os Filer_OpenDir <ReadNews$TempDir>
- #else
- #Output post
- To: %1%
- Subject: uuencoded %0% archive within
-
- The following is a uuencoded archive, created with %0%.
- Trim out everything before the first 'cut here' line and feed
- to a uudecoder/archive utility (eg Spark).
-
- Original archive name: %2%
-
- BEGIN---------- Cut Here ----------
- #os set Alias$UUencoding uue <leaf>
- #task UUencoding
- #os Unset Alias$UUencoding
- #os remove <leaf>
- #os seteval leaf leaf LEFT 6
- #include <leaf>_uue
- #os remove <leaf>_uue
- END------------ Cut Here ----------
- #endif
- #
- # Leave everything the way we found it!
- #
- #os unset leaf
- #os Unset newleaf
- #os unset branch
- #os Back
-