' ------------------------------------------ ' 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,"
") ' 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 "
" 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 "" #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 "" html "" html "" html "" html "" html "" html "" WEND html "
Seq Path Common Dir Seq With Path
";seq;"";path$(seq);"";dir$;"";t1Seq;"";path$(t1Seq);"
" wait end