home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
RSCOPY.ZIP
/
RSCOPY.CMD
next >
Wrap
OS/2 REXX Batch file
|
1992-11-14
|
2KB
|
69 lines
/* Do intelligent copy if source newer than target, or target doesn't exist */
call RxFuncAdd 'SysFileTree', 'RexxUtil', 'SysFileTree'
s_file.=0
t_file.=0
parse arg source
parse var source source target
target = strip(target)
source = strip(source)
if target = "" then do
say 'No target specified!'
return -1
end /* Do */
if source = "" then do
say 'No source specified!'
return -1
end /* Do */
rc = SysFileTree(source, 's_file', 'TF')
if rc then do say 'No SOURCE file'
return -1
end /* Do */
if s_file.0 = 0 then do
say 'No source files for' source
return 0
end /* Do */
say 'Checking' s_file.0 'file(s) in' source
copied = 0
do i = 1 to s_file.0
parse var s_file.i s_time size attrib s_name
s_time = translate(s_time,'','/',x2c('00'x))
if right(target,1) \= '\' then
target = target||'\'
t_name = FileSpec(drive,target)||FileSpec(path,target)||FileSpec(name,s_name)
rc = SysFileTree(t_name, 't_file', 'TF')
if t_file.0 = 0 then do
say '--' t_name 'NOT THERE so copying'
'@copy' s_name t_name '>nul'
copied = copied + 1
end /* Do */
else do
parse var t_file.1 t_time rest
t_time = translate(t_time,'','/',x2c('00'x))
if s_time > t_time then do
say ' older target so Copying' s_name 'to' target
'@copy' s_name t_name '>nul'
copied = copied + 1
end /* Do */
end /* Do */
end /* do */
if copied \= 0 then do
say copied 'file(s) copied to' target
say
end
else do
say '*** NO FILES COPIED ***'
say
end
return 0