ASPL Programming ver 1.00
© 2024 Bassem W. Jamaleddine


12-2

   Script dircompare.aspl

Comparing directories and files on the UNIX system is easy with ASPL. The following chapter shows how to use ASPL scrip to compare two directories on your UNIX system.

In this tutorial the 'aspl >' refers to the ASPL prompt, and the '#' refers to the shell prompt.

The following script:

       [Top Text]

 -L- Listing. 12.2.1   [LISTING dircompare.aspl][ASPL Script dircompare.aspl]
(raw text)
1.      #!/usr/bin/env /opt/ASPLv1.00/bin/aspl
2.      #ENVARG= -groupingclass POSIX -wsname TRANSIENT -singlepass 
3.      
4.      ;;***********************************************************************
5.      ;;   dircompare.aspl
6.      ;;
7.      ;;   This example shows the power of ASPL in doing UNIX directories
8.      ;;   comparison. The directories are treated as ASPL groups, and their
9.      ;;   their subdirectories as subgroups, and their files as elements
10.     ;;
11.     ;;***********************************************************************
12.     
13.     endScriptIfShellArgsLessThan 2
14.     
15.     ;; tee -a /public/tee/dircompare.aspl.tee
16.     DEF FN cmp2sets := {gU {g\, %%1 %%2}{g\, %%2 %%1}{g&, %%1 %%2}}
17.     
18.     timeout 60
19.     displayoff
20.     
21.     ks chksum size ppdd ffl
22.     
23.     d1 = ggdir(grp1,$1,dir,$1)
24.     d2 = ggdir(grp1,$2,dir,$2)
25.     
26.     displayon
27.     ks chksum size mtime ffl
28.     ;; sequencing lcs
29.     g%U d1 d2
30.     sim d1 d2
31.     FN cmp2sets(d1,d2)
32.     
33.     endscript
34.     
35.     __END__
36.     
37.       $00 compares two directories
38.     
39.       $00 must be followed by the names of two directories
40.     
41.       Example: To compare the two directories /tmp/aa3 and /tmp/aa6 
42.     
43.         $00 /tmp/aa3 /tmp/aa6
44.     

ASPL(C) 2024 Bassem Jamaleddine

       Figure dircompare.png
full view

Image File

 -F- Fig. 12.2.1   [COMPARING UNIX FILESYSTEM DIRECTORIES]
ASPL (C) 2024 Bassem Jamaleddine

This example is shown in the following terimal.

       display or terminal for Example: Script direcompare
viewme

 -E- Display. 12.2.1   [SCRIPT DIRCOMPARE.ASPL][Script dircompare.aspl]
dircompare.aspl script