the_files_command

The FILES Command

 * 1) Gets information about files and sub-folders of a selected folder
 * 2) Gets a list of files specified by the search pattern


 * ~ Table of Information stored by the FILES command||
 * ~ info$||~ 0||~ 1||~ 2||~ 3||
 * ~ 0||= Number of Files (**x**)||= Number of Subfolders (**X**)||= Drive||= Path of Folder||
 * ~ 1||= Name of File 1||= File Size||= Date and Time last modified||= Attributes (``*``)||
 * ~ 2||= Name of File 2||= File Size||= Date and Time last modified||= Attributes (``*``)||
 * ~ x||= Name of last File||= File Size||= Date and Time last modified||= Attributes (``*``)||
 * ~ x+1||= Path of Subfolder 1||= Name of Subfolder 1|| || ||
 * ~ x+2||= Path of Subfolder 2||= Name of Subfolder 2|| || ||
 * ~ x+X||= Path of last Subfolder||= Name of last Subfolder|| || ||
 * ~ x+1||= Path of Subfolder 1||= Name of Subfolder 1|| || ||
 * ~ x+2||= Path of Subfolder 2||= Name of Subfolder 2|| || ||
 * ~ x+X||= Path of last Subfolder||= Name of last Subfolder|| || ||
 * ~ x+X||= Path of last Subfolder||= Name of last Subfolder|| || ||


 * ~ (``*``) Attributes||
 * ~ r ...||Read only||
 * ~ h ...||Hidden||
 * ~ s ...||System file (do not touch)||
 * ~ a ...||File marked to be archived (used by backup applications)||

 code format="lb" dim info$(1,1)

filedialog "Select file...", "*.*", fileChoosen$

files GetPath$(fileChoosen$), info$

print print "Number of Files ..... "; info$(0,0) print "Number of Subdirs ... "; info$(0,1) print "Drive ............... "; info$(0,2) print "Path ................ "; info$(0,3) print

fileNum  = val(info$(0,0)) subdirNum = val(info$(0,1))

for num = 1 to fileNum print "File "; using("####",num); " .............. "; info$(num,0) print "File "; using("####",num); " Size ......... "; info$(num,1) print "File "; using("####",num); " Time ......... "; info$(num,2) print "File "; using("####",num); " Attributes ... "; info$(num,3) print next

for num = 1 to subdirNum print "Subdir "; using("####",num); " Path ...... "; info$(fileNum + num,0) print "Subdir "; using("####",num); " Name ...... "; info$(fileNum + num,1) print next end

function GetPath$(input$) bsPos = len(input$) while mid$(input$, bsPos, 1) <> "\" and bsPos > 0 bsPos = bsPos - 1 wend

if bsPos <> 0 then GetPath$ = left$(input$,bsPos) else GetPath$ = "" end if end function code

 code format="lb" dim info$(1,1)

files DefaultDir$, "*.bas", info$

print print "Number of Files ..... "; info$(0,0) print "Number of Subdirs ... "; info$(0,1) print "Drive ............... "; info$(0,2) print "Path ................ "; info$(0,3) print

fileNum = val(info$(0,0))

for num = 1 to fileNum print "File "; using("####",num); " .............. "; info$(num,0) print "File "; using("####",num); " Size ......... "; info$(num,1) print "File "; using("####",num); " Time ......... "; info$(num,2) print "File "; using("####",num); " Attributes ... "; info$(num,3) print next end code