87 lines
2.2 KiB
Plaintext
87 lines
2.2 KiB
Plaintext
' ------------------------------------------
|
|
' Find common directory to all directories
|
|
' and directories common with other Paths
|
|
' ------------------------------------------
|
|
print word$(word$(httpget$("http://tycho.usno.navy.mil/cgi-bin/timer.pl"),1,"UTC"),2,"<BR>") ' Universal time
|
|
|
|
dim path$(20)
|
|
path$(1) = "/home/user1/tmp/coverage/test"
|
|
path$(2) = "/home/user1/tmp/covert/operator"
|
|
path$(3) = "/home/user1/tmp/coven/members"
|
|
|
|
path$(4) = "/home/user1/tmp1/coverage/test"
|
|
path$(5) = "/home/user1/tmp1/covert/operator"
|
|
path$(6) = "/home/user1/tmp1/coven/members"
|
|
|
|
path$(7) = "/home/user1/tmp2/coverage/test"
|
|
path$(8) = "/home/user1/tmp2/covert/operator"
|
|
path$(9) = "/home/user1/tmp2/coven/members"
|
|
|
|
path$(10) = "/home/user1/tmp3/coverage/test"
|
|
path$(11) = "/home/user1/tmp3/covert/operator"
|
|
path$(12) = "/home/user1/tmp3/coven/members"
|
|
|
|
sqliteconnect #mem, ":memory:"
|
|
#mem execute("CREATE TABLE dirTree (seq,pos,dir)")
|
|
|
|
for i = 1 to 12
|
|
j = 1
|
|
[loop]
|
|
j = instr(path$(i),"/",j + 1)
|
|
if j > 0 then
|
|
dir$ = mid$(path$(i),1,j)
|
|
mem$ = "INSERT INTO dirTree VALUES (";i;",";j;",'";dir$;"')"
|
|
#mem execute(mem$)
|
|
goto [loop]
|
|
end if
|
|
next i
|
|
|
|
mem$ = "SELECT dir FROM dirTree GROUP BY dir HAVING count(*) = pos ORDER BY pos desc LIMIT 1"
|
|
#mem execute(mem$)
|
|
rows = #mem ROWCOUNT() 'Get the number of rows
|
|
if rows > 0 then
|
|
#row = #mem #nextrow()
|
|
print "====== Largest Directory Common to all Paths ========="
|
|
print #row dir$()
|
|
else
|
|
print "No common Directory"
|
|
end if
|
|
|
|
html "<HR>"
|
|
|
|
print "========= Common paths ================"
|
|
|
|
mem$ = "SELECT t.seq as seq,t.pos as pos,t.dir as dir,t1.seq as t1Seq ,t1.dir as t1Dir
|
|
FROM dirTree as t
|
|
JOIN dirTree as t1
|
|
ON t1.dir = t.dir
|
|
AND t1.seq > t.seq
|
|
GROUP BY t.dir,t1.seq"
|
|
|
|
html "<table border=1><TR align=center>
|
|
<TD>Seq</TD>
|
|
<TD>Path</TD>
|
|
<TD>Common Dir</TD>
|
|
<TD>Seq</TD>
|
|
<TD>With Path</TD></TR>"
|
|
|
|
#mem execute(mem$)
|
|
WHILE #mem hasanswer()
|
|
#row = #mem #nextrow()
|
|
seq = #row seq()
|
|
t1Seq = #row t1Seq()
|
|
pos = #row pos()
|
|
dir$ = #row dir$()
|
|
t1Dir$ = #row t1Dir$()
|
|
html "<TR>"
|
|
html "<TD>";seq;"</TD>"
|
|
html "<TD>";path$(seq);"</TD>"
|
|
html "<TD>";dir$;"</TD>"
|
|
html "<TD>";t1Seq;"</TD>"
|
|
html "<TD>";path$(t1Seq);"</TD>"
|
|
html "</TR>"
|
|
WEND
|
|
html "</TABLE>"
|
|
wait
|
|
end
|