Hello [EMAIL PROTECTED]

On 22-Jun-00, [EMAIL PROTECTED] wrote:
> 
> I'm guessing that somebody out there has modified the original RIP
> script to be recursive.  I'm in the middle of some stuff and could
> sure use that right about now.  Anyone want to help me out and mail it 
> to me, post it to the list, or post it to REBOL.org?
> 
> Thanks,
> 
> Sterling
>
This is odd the file that daedzaphod sent is diiferent that the 1 I have so
here is that 1. 
Regards
-- 
Captain, we´re sorry. We thought you were dead. - I was. I´m better now.
-- Drazi and Sheridan
JMS Trustee http://www.jms.org
HP=http://www.sonic.net/~alanwall/
First computer solar powered vic-20
AmigaQNX-notAmigaNG=no good
computers for people not suits
sent via Yam ver2 on AmigaForever ver3
Be a Rebel get [EMAIL PROTECTED]
UIN#=9391028
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


Reply via email to