[REBOL] Re: File versions: HELP!
From: agem:crosswinds at: 6-Jul-2001 16:58
RE: [REBOL] Re: File versions: HELP!
Hi Mario!
[rebol []
{
could this give tips?
change the output in 'mutants? ..
}
;libs below, remember [do main] at end..
main: [
;---prepare test
write %test_thai.txt {Hello Thais!}
write %test.txt {Hello Thais!}
; bat-contents: read/lines %...
bat-content: {
copy %1/path/filename.ext %2/path/filename.ext
isql %1/path/filename.ext parm1 parm2...
copy %1/test.txt parm1 parm2...
}
??? bat-content: parse/all bat-content "^/"
;---main main
log: copy ""
emit: func [s] [repend log s]
; CD ROM
CD-path: %./
; SourceSafe local checkout
SS-path: %/d/customer1/data/
;---get directories
set [cd-files cd-dirs]
find-files-deep/drop-dir CD-path true true
? cd-files
set [ss-files ss-dirs]
find-files-deep/drop-dir CD-path true true
? ss-files
mutants?: func [file] [
emit ["^/" mold file]
either not find ss-files file [
emit [" not on ss^/"]
] [emit " ok^/"]
foreach app [%_thai %_china] [
??? file-i18n:
head insert find/last copy file %. app
emit ["^-" mold file-i18n]
either not find cd-files file-i18n [
emit [" not on cd^/"]
] [emit " ok^/"]
]
append log "^/"
]
foreach line bat-content [
print "---"
? line
if probe parse/all line [
thru "%1/" copy file to " " to end
] [
? file
mutants? to file! file
]
]
probe head cd-files
print ["log:^/" log]
]
;lib
???: func ['word value] [print [
mold :word mold type? :value ":" mold :value]
word :value]
;---read dirs func
find-files-deep: func [
"returns [files dirs]"
dir
file-accepted?
"func which checks if you like this file"
dir-accepted?
"func which checks if you like this dir"
/drop-dir "remove base-dir-name from files"
/insert-dirs "insert dirs in file-block too"
/stars "show stars to show we are living"
/local files dirs file take
] [
max-dirs: 512 ;hard break on recursive links..
files: make block! max-dirs * 16
dirs: make block! max-dirs
append dirs dir ;yes [reduce[dir]] works too :)
foreach dir dirs [
if max-dirs < length? dirs [
make error! rejoin [
{to many dirs? > " max-dirs " !
recursive links somewhere?}
]
]
if insert-dirs [append files dir]
foreach file sort read dir [
file: join dir file
if drop-dir [file: skip file length? dir]
if stars [prin "*"] ; are we alive?
any [
if dir? file [
; allows check to be 'true
take: dir-accepted? file
if take [
append dirs file
true
]]
if file? file [
; allows check to be 'true
take: file-accepted? file
if take [append files file] true
]
make error! join {interesting kind of file..: } mold file
]
]
]
reduce [files head dirs]
]
;go
do main
]
[Mario--Cassani--icl--com] wrote: