[REBOL] Re: File versions: HELP!
From: mario:cassani:icl at: 6-Jul-2001 16:47
Hi "mage" (egam),
thankyou very much, changing a bit your script will
save my weekend!!!
This was my work to compare a list of files with
two directories...
8<-----------8<-----------8<-----------8<-----------8<-----------
REBOL [
]
CD-path: %/d/Ufficio/mo_CD/
SS-path: %/d/Ufficio/mo_SS/
locales: ["_china." "_thai." "_ch." "_th."]
verificare: read/lines %EVERY-List.txt
; *** MAIN ***
if exists? %missing_on_cd.txt [delete %missing_on_cd.txt]
foreach vfile verificare [
output-tail: ""
vfile-size: join " [" [size? SS-path/:vfile "]"]
foreach locale locales [
if find vfile locale [
if not exists? to-file vfile [write/append %missing_on_cd.txt join
vfile [vfile-size newline]]
output-tail: join " <<- " vfile
replace vfile locale "."
break
]
]
if not exists? to-file vfile [write/append %missing_on_cd.txt join vfile
[vfile-size output-tail newline]]
]
halt
8<-----------8<-----------8<-----------8<-----------8<-----------
I added the following but with no good results, how can I
know if the parse found the string? With a separate 'find?
The script goes wrong also when something like
rem copy %1\where\file.ext d:\destination
call other.bat %1 %2 %3 %4
that should be ignored while
call other.bat %1\other\path\file.txt %2 %3 %4
that's ok
8<-----------8<-----------8<-----------8<-----------8<-----------
path-China: %/l/
path-Thai: %/o/
;recursive-files: function [pathSrc [file!] pathDes [file!]] [files file
file-list] [
recursive-files: function [pathSrc [file!]] [files file file-list] [
files: load pathSrc
file-list: to-block 1
foreach file files [
either dir? join pathSrc file [
append file-list recursive-files join pathSrc file
;print pathSrc/:file
][
append file-list join pathSrc file
; Use only .BAT scripts
if ".bat" = find/last form file ".bat" [
fileSource: pathSrc/:file
bat-file: read/lines fileSource
foreach bfile bat-file [
parse bfile [thru %1 copy b-file to " "]
if not exists? to-file pathSrc/:b-file [print join
pathSrc/:b-file [" *** " bfile]]
]
]
]
]
return file-list
]
initialpath: currentpath: SS-path
if #"/" <> last currentpath [
append currentpath "/"
]
initialpath: currentpath
file-list: recursive-files currentpath
halt
8<-----------8<-----------8<-----------8<-----------8<-----------
Must finish the CD now...
Happy weekend to you all too
Mario