ASPL Manual v 1.00
© 2024 by SetSphere.COM


13. 15
   ggdir primitive to get the group of directories

 

logo

ggdir(dir,pathname)     where pathname is a user specified path to a directory on the UNIX system

ggdir  GADg  1            ous:H_H_H_H

●  Operator ggdir primitive to get the group of directories

Use the primitive function ggdir() to glob directories on the UNIX system. This function is defined the context of the POSIX grouping class.

 

ggdir EXAMPLE1
The script createtestff.pl creates test directories, subdirectories, and files on the UNIX system. In this example, we create a directory structure in /tmp/junk to show how to glob directories and test with ASPL operators. We start ASPL loading the sample workspace TESTGGDIR. We issue the ggdir() function to glob the directories /tmp/junk/dir1 and /tmp/junk/dir2.

 

ggdir OPERATION1

mkdir /tmp/junk
    (create the directory /tmp/junk)

createtestff.pl /tmp/junk
    (run createtestff.pl to create the directory structure)

tree /tmp/junk
    (view the directory structure in /tmp/junk)

tree -d /tmp/junk
    (view the subdirectories in the directory structure)

aspl -wsname TESTGGDIR -groupingclass POSIX
    (start ASPL loading the sample workspace TESTGGDIR)

①  aspl> egCwhoami
    (ping the grouping class)

②  aspl> ggls ggdir()
    (display the ggdir() function)

③  aspl> ggls ggdir
    (list all ggdir related functions)

④  aspl> timeout 90
    (set timeout to 90 seconds in case your system is too slow)

⑤  aspl> ks
    (print the ks vector along other related attributes information)

⑥  aspl> ks mtime chksum entropy ppdd ffl
    (set the ks vector to: mtime chksum entropy ppdd ffl)

⑦  aspl> sudir1 = ggdir(dir,/tmp/junk/dir1/subdir1.1/subdir1.2)
    (sudir1 set variable is assigned the directory /tmp/junk/dir1/subdir1.1/subdir1.2)

⑧  aspl> sudir2 = ggdir(dir,/tmp/junk/dir2/subdir2.1/subdir2.2)
    (sudir2 set variable is assigned the directory /tmp/junk/dir2/subdir2.1/subdir2.2)

⑨  aspl> tree /tmp/junk/dir1
    (print the tree representing the directory /tmp/junk/dir1)

⑩  aspl> tree /tmp/junk/dir2
    (print the tree representing the directory /tmp/junk/dir2)

⑪  aspl> sim sudir1 sudir2
    (display the similarity between sudir1 sudir2)

⑫  aspl> f& sudir1 sudir2
    (display the elements (files) intersection between sudir1 and sudir2)

⑬  aspl> g& sudir1 sudir2
    (display the groups (subdirectories and files) intersection between sudir1 and sudir2)

⑭  aspl> treed /tmp/junk/dir1
    (print the tree showing the subdirectories in /tmp/junk/dir1)

⑮  aspl> treed /tmp/junk/dir2
    (print the tree showing the subdirectories in /tmp/junk/dir2)

⑯  aspl> d& sudir1 sudir2
    (display the subgroups (subdirectories) intersection between sudir1 and sudir2)

⑰  aspl> dD sudir1 sudir2
    (display the subgroups (subdirectories) symmetric difference between sudir1 and sudir2)

⑱  aspl> d\ sudir1 sudir2
    (display the subgroups (subdirectories) symmetric difference between sudir1 and sudir2)

⑲  aspl> d\ sudir2 sudir1
    (display the subgroups (subdirectories) symmetric difference between sudir2 and sudir1)

⑳  aspl> dU sudir1 sudir2
    (display the subgroups (subdirectories) union between sudir1 and sudir2)

⑴  aspl> dir1 = ggdir(dir,/tmp/junk/dir1)
    (dir1 set variable is assigned the directory /tmp/junk/dir1)

⑵  aspl> dir2 = ggdir(dir,/tmp/junk/dir2)
    (dir2 set variable is assigned the directory /tmp/junk/dir2)

⑶  aspl> f& dir1 dir2
    (display the elements intersection between dir1 and dir2)

⑷  aspl> density dir1 dir2
    (display density histograms of dir and dir2)

⑸  aspl> y*& dir1 dir2
    (fuzzy match the elements and display the comparison)

 

ggdir EXAMPLE2
In this example we start ASPL loading the sample workspace TESTGGDIR. We issue the ggdir() function to glob the directories /tmp/testfinder/fuudir and /tmp/testfinder/locadir.

 

ggdir OPERATION2

aspl -wsname TESTGGDIR -groupingclass POSIX
    (start ASPL loading the sample workspace TESTGGDIR)

①  aspl> egCwhoami
    (ping the grouping class)

②  aspl> fuudir = ggdir(dir,/tmp/testfinder/fuudir)
    (fuudir set variable is assigned the directory /tmp/testfinder/fuudir)

③  aspl> locadir = ggdir(dir,/tmp/testfinder/locadir)
    (locadir set variable is assigned the directory /tmp/testfinder/locadir)

④  aspl> display fuudir
    (display the set variable fuudir)

⑤  aspl> f& fuudir locadir
    (display the intersection between fuudir and locadir)

⑥  aspl> sim fuudir locadir
    (display the similarity between fuudir and locadir)

 

ggdir EXAMPLE3
In this example we compare the naming classes of JNDI Jar files. Three JNDI Jar files are extracted in /tmp/JNDI/jndi1, /tmp/JNDI/jndi2, and /tmp/JNDI/jndi3. We start ASPL loading the sample workspace TESTGGDIR, then we issue the ggdir() to glob the directories into set variables. We issue set operators to compare the extracted Jar files.

 

ggdir OPERATION3

aspl -wsname TESTGGDIR -groupingclass POSIX
    (start ASPL loading the sample workspace TESTGGDIR)

①  aspl> naming1 = ggdir(dir,/tmp/JNDI/jndi1/javax/naming)
    (naming1 set variable is assigned the directory /tmp/JNDI/jndi1/javax/naming)

②  aspl> naming2 = ggdir(dir,/tmp/JNDI/jndi2/javax/naming)
    (naming2 set variable is assigned the directory /tmp/JNDI/jndi2/javax/naming)

③  aspl> naming3 = ggdir(dir,/tmp/JNDI/jndi3/javax/naming)
    (naming3 set variable is assigned the directory /tmp/JNDI/jndi3/javax/naming)

④  aspl> f& naming1 naming2 naming3
    (display the intersection between naming1 naming2 naming3)

⑤  aspl> fU naming1 naming2 naming3
    (display the intersection between naming1 naming2 naming3)

⑥  aspl> sim naming1 naming2 naming3
    (display the similarity between naming1 naming2 naming3)