|
Post by angelo2449 on Aug 2, 2020 4:48:35 GMT -5
Hi guys,
It is the second time that I propose this problem, the function does not detect the folder!
Thank you
Dim info$(10, 10), info1$(0, 0) ...... ...... #main.nome, "!contents? NomePrev$"
NomePrev$ = trim$(NomePrev$)
if DirExists("C:\AutocadSupporto\Preventivi\Lavori", NomePrev$) then
Notice "Attenzione" + chr$(13) + "La Cartella " + NomePrev$ + " esiste!"
wait
end if
result = mkdir(AS$ + "Preventivi\Lavori\" + NomePrev$)
Notice "La Cartella di Lavoro " + NomePrev$ + " รจ stata creata!"
..... .....
function DirExists(path$, dirname$)
files path$, chr$(0), info1$()
dirExists = 0
If Val(info1$(0,1)) > 0 Then
For i = 1 To Val(info1$(0,1))
If info1$(i, 1) = dirname$ Then
dirExists = 1
Exit Function
End If
next
end if
end function
|
|
|
Post by Brandon Parker on Aug 2, 2020 8:47:26 GMT -5
Try this one and see where you get ... it never fails me ...
Global False : False = 0 Global True : True = 1
Dim Info$(0, 0)
Print searchForFolder("Some directory; no trailing backslash", "folderName") End
Function searchForFolder(directory$, folder$) On Error GoTo [Error] directory$ = directory$ + "\" Files directory$, "*", Info$() If Val(Info$(0,1)) > 0 Then For i = 1 To Val(Info$(0,1)) If Lower$(Info$(Val(Info$(0,0)) + i, 1)) = Lower$(folder$) Then searchForFolder = True Exit For End If Next i End If ReDim Info$(0, 0) [Error] End Function
EDIT: You will either need to create the Info$() array or substitute what you are using.
I believe this line is where your problem is most likely...
files path$, chr$(0), info1$()
{:0)
Brandon Parker
|
|