home *** CD-ROM | disk | FTP | other *** search
- /*
- $VER: VersionCopy.dopus5 1.3 (11.3.96)
- Written by Edmund Vermeulen (edmundv@grafix.xs4all.nl).
-
- ARexx script for Directory Opus 5.5 that shows the version information
- of all existing files before copying them.
-
- Function : ARexx DOpus5:ARexx/VersionCopy.dopus5 {Qp}
- */
-
- parse arg portname
- if portname='' then
- portname='DOPUS.1'
- address value portname
-
- options results
- options failat 21
- lf='0a'x /* linefeed */
-
- src=0
- dst=1
-
- lister query source
- if rc>0 then do
- dopus request '"No source selected." OK'
- exit
- end
- parse var result handle.src .
- lister query handle.src path
- path.src=result
-
- lister query dest
- if rc>0 then do
- dopus request '"No destination selected." OK'
- exit
- end
- parse var result handle.dst .
- lister query handle.dst path
- path.dst=result
-
- lister set handle.src busy on
- lister set handle.dst busy on
-
- lister query handle.src numseldirs
- if result>0 then do
- dopus request '"VersionCopy cannot check version'lf||,
- 'information of files in directories.'lf||lf||,
- 'Do you want to copy them anyway?" Copy|Skip|Abort'
- if rc=0 then do
- lister set handle.src busy off
- lister set handle.dst busy off
- exit
- end
- if rc=2 then do
- lister query handle.src seldirs stem dir.
- do i=0 to dir.count-1
- lister select handle.src '"'dir.i'"' off
- end
- end
- end
-
- lister query handle.src selfiles stem file.
- lister set handle.src newprogress name bar abort
- lister set handle.src newprogress title 'Comparing...'
-
- do i=0 to file.count-1
- lister set handle.src newprogress name file.i
- lister set handle.src newprogress bar file.count i+1
-
- if exists(path.dst||file.i) then do /* does it already exist? */
- do j=0 to 1
- address command 'Version >T:Version.temp "'path.j||file.i'" FILE FULL'
- if rc=0 then do
- call open('tempfile','T:Version.temp','r')
- version.j=readln('tempfile')
- call close ('tempfile')
- if length(version.j)>48 then
- version.j=left(version.j,45)'...'
- end
- else
- version.j='no version info found'
- lister query handle.j entry '"'file.i'"' stem fileinfo.
- size.j=fileinfo.size
- end
- command delete quiet 'T:Version.temp'
-
- dopus request '"File '''file.i''' already exists. Replace it?'lf||lf||,
- 'New :' version.src '- Size :' size.src||lf||,
- 'Old :' version.dst '- Size :' size.dst'" Replace|Skip|Abort'
- choice=rc
- if choice=2 then
- lister select handle.src '"'file.i'"' off
-
- lister query handle.src abort
- if result|choice=0 then do
- lister refresh handle.src
- lister clear handle.src progress
- lister set handle.src busy off
- lister set handle.dst busy off
- exit
- end
- end
- end
-
- lister clear handle.src progress
- lister refresh handle.src
- lister set handle.src busy off
- lister set handle.dst busy off
-
- lister set handle.src source
- lister set handle.dst dest
- command copy quiet
-