|
Post by kokenge on Apr 11, 2009 11:10:02 GMT -5
Ok! I give up.. How do I get a list of all the sub-directories within a directory. Thanks for the help..
|
|
|
Post by Brent on Apr 11, 2009 12:48:57 GMT -5
Try this : print DefaultDir$ files #fs, DefaultDir$ + "\*" for i = 1 to #fs rowcount() #fs nextfile$() if #fs isdir() then print " "; #fs name$() next end The behavior of FILES' wildcards seem to be non-standard on the Windows platform where "*.*" would normally find all files and directories because all names have an extension even if it's a null string. For example, at the Command Prompt, try cd \windows.\system.\
|
|
|
Post by kokenge on Apr 11, 2009 15:38:19 GMT -5
That works....
Thanks!
|
|
|
Post by kokenge on Apr 14, 2009 8:30:49 GMT -5
Again thanks. I was able to get the RB directory and subdirectories using your code. Anyway I wrote it to expands and compress directory trees, plays video and music, and view photos. I needed this because in some cases the upload does not work. ' ---------------------------------------------------------- ' Indented expand/compress RB directory BOM ' ---------------------------------------------------------- bf$ = "<SPAN STYLE='font-family:Arial; font-weight:700; font-size:10pt'>" html bf$;"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 ><TR><TD id=wkArea></TD></TR></TABLE>"
path$ = DefaultDir$ path$ = "c:\rbp101\projects"
html bf$;"<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0><tr><td>"
lvl = 1 print "path:";path$ + "\*" [loop]
files #fs, path$ + "\*" rows = #fs rowcount() for i = 1 to rows #fs nextfile$() name$ = #fs name$() d = #fs isdir() id$ = lvl;"|";name$ if d = 1 then html "</TD></TR><TR><TD id=";id$;">";indent$;lvl button #l1,"+ ";name$, [lvl] #l1 setkey("+|";id$;"|";path$) dirName$ = name$ else html "<BR>";indent$;lvl button #l1,"Go",[go] #l1 setkey(id$;"|";path$) html " ";name$ end if next i if pm$ = "" then html "</TD></TR></TABLE>" else html "';</script>" end if wait
[lvl] pm$ = word$(EventKey$,1,"|") lvl$ = word$(EventKey$,2,"|") lvl = val(lvl$) + 1 name$ = word$(EventKey$,3,"|") ddir$ = word$(EventKey$,4,"|") path$ = ddir$;"\";name$
k = len(lvl$) id$ = lvl$;"|";name$ indent$ = "" for i = 1 to lvl indent$ = indent$ + "." next i
if pm$ = "-" then html "<script> document.getElementById('";id$;"').innerHTML = '" html lvl$ button #l1,"+ ";name$, [lvl] #l1 setkey("+|";id$;"|";ddir$) html "';</script>" wait end if html "<script> document.getElementById('";id$;"').innerHTML = '"
html lvl$;left$(indent$,-1) button #l1,"- ";name$, [lvl] #l1 setkey("-|";id$;"|";ddir$) goto [loop] wait
[go] lvl$ = word$(EventKey$,1,"|") name$ = word$(EventKey$,2,"|") ddir$ = word$(EventKey$,3,"|") path$ = ddir$;"\";name$
pix$ = ".png.jpg.bmp.jif" media$ = ".mp3.wmv" fileType$ = pix$;media$;".zip.exe.bas.php.htm.html.db"
hpath$ = strRep$(path$,"\","/") ' html needs fwd slashes hpath$ = strRep$(hpath$,"c:/rbp101/projects/","../") html "<script> document.getElementById('wkArea').innerHTML = '" html "Path:";hpath$;"<BR>" html "Name:";name$;"<BR>"
a$ = "" lname$ = lower$(name$) for i = 1 to len(lname$) if mid$(lname$,i,1) = "." then a$ = "." else a$ = a$ + mid$(lname$,i,1) end if next i
if a$ = ".zip" then html "Compressed file.<BR>" if a$ = ".exe" then html "Executable file.<BR>" if a$ = ".bas" then html "Run Basic file.<BR>" if a$ = ".php" then html "PHP file.<BR>" if a$ = ".htm" or a$ = ".html" then html "HTML file.<BR>" if a$ = ".db" then html "SQLite file.<BR>" if instr(pix$,a$) then html "Image file.<BR>" if instr(media$,a$) then html "Media file.<BR>"
if instr(pix$,a$) or instr(media$,a$) then html "<EMBED SRC=""";hpath$;""">" html "<BR>" end if
if instr(fileType$,a$) = 0 then html "Unknown file type.<BR>"
button #p,"Copy", [copy] #p setkey(path$) html "';</script>" wait [copy] print "Place copy code or whatever here" wait ' -------------------------------- ' string replace rep str with ' -------------------------------- FUNCTION strRep$(str$,rep$,with$) ln = len(rep$) ln1 = ln - 1 i = 1 while i <= len(str$) if mid$(str$,i,ln) = rep$ then strRep$ = strRep$ + with$ i = i + ln1 else strRep$ = strRep$ + mid$(str$,i,1) end if i = i + 1 WEND END FUNCTION
|
|