Well, RIP didn't have the ability to archive sub-directories, so I added 8
lines and changed one slightly so it could.. I've tested it a bit and it
seems to work well... So here it is (attached)
Cal Dixon
-><-
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
REBOL [
Title: "RIP - REBOL Binary Archiver"
Date: 22-Feb-2000
File: %rip.r
Author: "Carl Sassenrath"
Email: [EMAIL PROTECTED]
Version: 1.0.1
Purpose: {
Gathers and compresses files into a self extracting
archive file that has a REBOL header. Note that
resulting archive is BINARY for minimal size.
}
History: [
1.0.0 22-Feb-2000 "Carl Sassenrath" {Original code.}
1.0.1 24-Feb-2000 "Cal Dixon {Added subdirectoy support}
]
]
file-types: [%.r %.txt %.html %.htm %.bmp %.jpg %.jpeg %.gif]
path: to-file ask {
Enter the directory path.
Press RETURN key for current directory,
or type a path in the form: dir/dir/dir
Directory? }
if empty? trim path [path: %./]
if (last path) <> #"/" [append path #"/"]
if not exists? path [print [path "does not exist"] halt]
file-list: []
archive: make binary! 32000
print "Archiving:"
foreach file (files: read path) [
if find file-types find/last file "." [
prin [tab file " "]
data: read/binary path/:file
prin [length? data " -> "]
data: compress data
print [length? data]
append archive data
append file-list reduce [file length? data]
]
if dir? path/:file [
append file-list reduce [file 'DIR ]
foreach newfile read path/:file [ append files file/:newfile ]
]
]
print [newline "Total size:" length? archive "Checksum:" checksum archive
newline]
filename: to-file ask "Output file name? "
if empty? trim filename [filename: %archive.rip]
if not find filename "." [append filename ".rip"]
if all [exists? filename not confirm reform ["Overwrite file" filename "?
"]] [
print "stopped" halt
]
header: mold compose/deep [
REBOL [
Title: "REBOL Self-extracting Binary Archive (RIP)"
Date: (now)
File: (filename)
Note: (reform [{To extract, type REBOL} filename {or run REBOL and
type: do} filename])
]
file: (filename)
size: (length? archive)
path: (path)
files: (reduce [file-list])
check: (checksum archive)
secure none
if not exists? path [make-dir path]
archive: read/binary file
archive: next find/case/tail archive to-binary probe join "!DATA" ":"
if check <> checksum archive [print ["Checksum failed" check checksum
archive] halt]
print "Reviving:"
foreach [file len] files [
print [tab file]
either len = 'DIR [
if not exists? path/:file [ make-dir path/:file ]
][
data: decompress copy/part archive len
archive: skip archive len
either any [
not exists? path/:file
confirm reform [file "already exists - overwrite? "]
][write/binary path/:file data][print "skipped"]
]
]
]
insert archive reduce [header newline "!DATA:" newline]
write/binary filename archive
quit