|
Post by Rod on Nov 27, 2022 5:54:15 GMT -5
I like the concept. Especially if we picked some of the lesser known commands.
|
|
honky
Junior Member
Posts: 62
|
Post by honky on Nov 27, 2022 8:26:33 GMT -5
Excellent idea. Especially with the sequences of: ";" ";";"; and no ";" Of which an exhaustive list would be very good in the help
|
|
|
Post by mknarr on Nov 27, 2022 10:02:27 GMT -5
I'll start and I can't take credit for this but refer to it often FILES COMMAND
|
|
|
Post by Rod on Nov 27, 2022 12:51:08 GMT -5
So how would we use the info in this table to list sub folders in the current folder?
|
|
|
Post by Brandon Parker on Dec 1, 2022 23:35:32 GMT -5
Here are a few functions for working with subdirectories...
'This does not work over a network Dim Info$(10, 10) Global True : True = 1 Global False : False = 0
directory$ = "Your directory ... no trailing \" folder$ = "Your folder name"
Print searchForFolder(directory$, folder$) Print searchForFolder$(directory$, folder$)
'Return the list of subdirectories separated by your specified delimiter Print listSubFolders$(directory$, "|") End
Function listSubFolders$(directory$, delim$) Files directory$, "*", Info$() If Val(Info$(0,1)) > 0 Then For i = 1 To Val(Info$(0,1)) listSubFolders$ = listSubFolders$ + Info$(Val(Info$(0,0)) + i, 1) + delim$ Next i listSubFolders$ = Left$(listSubFolders$, Len(listSubFolders$) - 1) Else searchForFolder$ = "This directory contains no subdirectories." End If End Function
Function searchForFolder$(directory$, folder$) Files directory$, "*", Info$() If Val(Info$(0,1)) > 0 Then For i = 1 To Val(Info$(0,1)) If Info$(Val(Info$(0,0)) + i, 1) = folder$ Then searchForFolder$ = "SubDir# " + str$(i) + " " + folder$ Exit Function End If If i = Val(Info$(0,1)) Then searchForFolder$ = chr$(34) + folder$ + chr$(34) + " is not a subdirectory of " + chr$(34) + directory$ + chr$(34) End If Next i Else searchForFolder$ = "This directory contains no subdirectories." End If End Function
Function searchForFolder(directory$, folder$) Files directory$, "*", Info$() If Val(Info$(0,1)) > 0 Then For i = 1 To Val(Info$(0,1)) If Info$(Val(Info$(0,0)) + i, 1) = folder$ Then searchForFolder = True Exit Function End If Next i End If End Function
{:0)
Brandon Parker
|
|
|
Post by Walt Decker on Jan 13, 2023 10:17:47 GMT -5
Where is there an indication that the given path does not exist?
|
|