page@swan.ulowell.edu (Bob Page) (03/16/89)
Submitted-by: CB%frambo.DEC@decwrl.dec.com (Christian Balzer) Posting-number: Volume 89, Issue 54 Archive-name: util/archie.1 Archie.rexx will copy all files that don't have the archive bit set from SOURCE and it's subdirectories to DESTINATION. If these directories don't exist at DESTINATION, Archie will try to create them on the fly and thus preserving the original structure at SOURCE. After the file has been copied, it's archive bit will be set. Equalize.rexx is a utility for Archie and will scan all files at SOURCE and it's subdirectories and compare them to the files at DESTINATION and the corresponding subdirectories. ALL files at DESTINATION that can't be found in SOURCE will be DELETED!!! This goes for directory trees, too!!! System requirements: Any Amiga model, 512 KB, ARexx. Especially useful for people with more than one hard disk or other mass storage devices. I call Archie every 2 hours from AmiCron and Equalize once a week to keep a backup of valuable data from my large HD on my smaller one. # This is a shell archive. # Remove everything above and including the cut line. # Then run the rest of the file through sh. #----cut here-----cut here-----cut here-----cut here----# #!/bin/sh # shar: Shell Archiver # Run the following text with /bin/sh to create: # Archie.rexx # Equalize.rexx # This archive created: Wed Mar 15 13:22:18 1989 cat << \SHAR_EOF > Archie.rexx /* Archie.rexx -- a backup utility by <CB> aka Christian Balzer based on du.rexx by Larry Phillips. _ _ / / | \ \ <CB> aka Christian Balzer - The Software Brewery - < < |-< > UUCP: decwrl!frambo.dec.com!cb OR cb@frambo.dec.com \ \_ |_/ / CIS : 71001,210 (be brief!) | Phone: +49 6150 4151 (CET!) ------------ Mail: Im Wingertsberg 45, D-6108 Weiterstadt, F.R.G. Usage: [rx] Archie SOURCE DESTINATION [-options] SOURCE and DESTINATION are valid AmigaDOS path's WITHOUT trailing slashes '/'. Valid options are: Currently none... Archie will copy all files that don't have the archive bit set from SOURCE and it's subdirectories to DESTINATION. If these directories don't exist at DESTINATION, Archie will try to create them on the fly and thus preserving the original structure at SOURCE. After the file has been copied, it's archive bit will be set. Note: The files will be copied with 'CLONE' flag of the COPY command set. This of course only works with the 1.3 version of COPY. In this version of Archie, filenames or directories containing blanks (like "My Dir:My File"), are NOT supported! */ /* This is Public Domain, read the source and learn */ say 'Archie 1.6 (12-Jan-89) by <CB>' /* open the Rexx support library */ if ~show('L',"rexxsupport.library") then do if addlib('rexxsupport.library',0,-30,0) then say 'added rexxsupport.library' else do; say 'support library not available' exit 10 end end address command call pragma 'priority',-1 arg rein /* The parser */ copt = 'clone' if words(rein) < 2 then do say 'Come on, gimme a SOURCE *AND* a DESTINATION path' say 'Ya better try again... Bye!' exit 10 end root = subword(rein,1,1) dest = subword(rein,2,1) if ~ exists(root) then do say 'Source not found' say 'Exiting... Check your parameters' exit 10 end if ~ exists(dest) then do say 'Destination not found' say 'I''ll try to create it for you...' 'makedir 'dest if ~ exists(dest) then do say 'Exiting... Check your parameters' exit 15 end say 'Created 'dest end if right(root,1) ~= ':' then root = root || '/' if root = '/' then root = '' if right(dest,1) ~= ':' then dest = dest || '/' if dest = '/' then dest = '' rlen = length(root) bytes = 0 blocks = 0 files = 0 dircount = 1 say 'Archie is doing it''s job on 'root call dolist(root) say say 'Archived:' bytes 'bytes,' blocks 'blocks, ', files 'files in a total 'dircount' directories.' exit 0 . /* The real thing */ dolist: procedure expose bytes blocks files dest rlen dircount copt parse arg x contents = showdir(x); do i = 1 to words(contents) temp = x || word(contents,i) flen = length(word(contents,i)) type = statef(temp) if word(type,1) = 'FILE' then do if substr(word(type,4),4,1) = '-' then do target = dest || right(temp,(length(temp) - rlen)) 'copy 'temp target copt /* if RC > 0 then say 'Error archiving 'temp else */ do files = files + 1 bytes = bytes + word(type,2) blocks = blocks + word(type,3) + 1 'protect 'temp 'a add' /* if RC > 0 then say 'Error protecting 'temp else */ say 'Archived: 'temp end end end if word(type,1) ='DIR' then do subdir = dest || right(temp,(length(temp) - rlen)) if ~ exists(subdir) then do 'makedir' subdir if ~ exists(subdir) then do say 'Sorry... Exiting' exit 20 end say ' *** Created directory' subdir end call dolist(temp || '/') dircount = dircount + 1 end end return SHAR_EOF cat << \SHAR_EOF > Equalize.rexx /* equalize.rexx -- a utility for Archie by Christian '<CB>' Balzer -- _ _ / / | \ \ <CB> aka Christian Balzer - The Software Brewery - < < |-< > UUCP: decwrl!frambo.dec.com!cb OR cb@frambo.dec.com \ \_ |_/ / CIS : 71001,210 (be brief!) | Phone: +49 6150 4151 (CET!) ------------ Mail: Im Wingertsberg 45, D-6108 Weiterstadt, F.R.G. Usage: [rx] equalize SOURCE DESTINATION [-options] SOURCE and DESTINATION are valid AmigaDOS path's WITHOUT trailing slashes '/'. Valid options are: -p This option will only print the differing filenames, but not delete them. Use it to see if you aren't about to destroy your work! Equalize will scan all files at SOURCE and it's subdirectories and compare them to the files at DESTINATION and the corresponding subdirectories. ALL files at DESTINATION that can't be found in SOURCE will be DELETED!!! This goes for directory trees, too!!! WARNING!!! Use this beast only when you know what you're doing! :-) BTW, the name of this utility wasn't inspired by the TV series "The Equalizer". Or was it? :-) In this version, filenames or directories containing blanks (like "My Dir:My File"), are NOT supported! */ /* This is Public Domain, read the source and learn */ say 'Equalize 1.2 (13-Jan-88) by <CB>' /* open the Rexx support library */ if ~show('L',"rexxsupport.library") then do if addlib('rexxsupport.library',0,-30,0) then say 'added rexxsupport.library' else do; say 'support library not available' exit 10 end end address command call pragma 'priority',-1 arg rein /* The parser */ copt = 'clone' if words(rein) < 2 then do say 'Come on, gimme a SOURCE *AND* a DESTINATION path' say 'Ya better try again... Bye!' exit 10 end root = subword(rein,1,1) dest = subword(rein,2,1) dstat = 1 if ~ exists(root) then do say 'Source not found' say 'Exiting... Check your parameters' exit 10 end if ~ exists(dest) then do say 'Destination not found' say 'Exiting... Check your parameters' exit 15 end if words(rein) > 2 then do if subword(rein,3,1) = '-P' then dstat = 0 end if right(root,1) ~= ':' then root = root || '/' if root = '/' then root = '' if right(dest,1) ~= ':' then dest = dest || '/' if dest = '/' then dest = '' dlen = length(dest) bytes = 0 files = 0 dircount = 1 say 'Equalize is doing it''s job on 'dest call dolist(dest) say say 'Deleted:' files 'files in a total 'dircount' directories.' say 'This equalization cleared:' bytes 'Bytes.' exit 0 /* The real thing */ dolist: procedure expose files root dest dlen dircount bytes dstat parse arg x contents = showdir(x); do i = 1 to words(contents) temp = x || word(contents,i) type = statef(temp) if word(type,1) = 'FILE' then do snam = root || right(temp,(length(temp) - dlen)) if ~ exists(snam) then do files = files + 1 bytes = bytes + word(type,2) if dstat = 1 then do 'delete 'temp say 'Deleted: 'temp end else say 'Would have deleted: 'temp end end if word(type,1) ='DIR' then do subdir = root || right(temp,(length(temp) - dlen)) if ~ exists(subdir) then do say 'Subdirectory 'subdir' not found...' if dstat = 1 then do 'delete 'temp' all' say 'Removed: 'temp end else say 'Would have removed: 'temp end call dolist(temp || '/') dircount = dircount + 1 end end return SHAR_EOF # End of shell archive exit 0 -- Bob Page, U of Lowell CS Dept. page@swan.ulowell.edu ulowell!page Have five nice days.