Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner
' Mark Parkinson ' 08/10/02 ' This program will list all the files in the whole directory structure ' which match the given file spec. A process called recursion is used. ' Feel free to use and adapt the program eg to sum the filespace used or ' delete files or rename files or move them. ' It is also easy to adapt the program to delete empty subdirectories. dim info$(10, 10) 'Ready for the files command. 'Note no backslash - added later on. placetohunt$="c:" thingtohuntfor$="*.bak" print "now listing all files in ";placetohunt$;" which match ";thingtohuntfor$ print call recurse placetohunt$, thingtohuntfor$ print print "finished" end sub recurse pathspec$,mask$ 'Put in the backslash separator. pathspec$=pathspec$+"\" files pathspec$, mask$, info$( filecount=val(info$(0, 0)) subdircount=val(info$(0, 1)) for i=1 to filecount filename$= pathspec$+info$(i, 0) filesize$= info$(i, 1) datestamp$=info$(i, 2) print filename$;" ";filesize$ next i 'Arrays cannot be local to subs so the subdirs 'are all put in a string separated by *'s which 'can't occur in filenames. list$="" for i=1 to subdircount list$=list$+pathspec$+info$(f + i, 1)+"*" next i 'The subdirs are now pulled out of the (local) 'string one at a time and the sub is called again. 'This process where a sub calls itself 'is called recursion. while list$<>"" p=instr(list$,"*") p$=left$(list$,p-1) call recurse p$,mask$ list$=mid$(list$,p+1) wend end sub
Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner