Test if a directory exsist

volvomann

Active Member
Licensed User
Longtime User
How can I test if a directory exsist when the app is starting, and if not create it?
 
Last edited:

mc73

Well-Known Member
Licensed User
Longtime User
I think you can use file.mkdir, without worrying whether the directory to be created exists or not.
Files - Basic4android Wiki

And you can check whether a file is directory by using:
IsDirectory (Dir As String, FileName As String) As Boolean
 
Upvote 0

volvomann

Active Member
Licensed User
Longtime User
I think you can use file.mkdir, without worrying whether the directory to be created exists or not.
Files - Basic4android Wiki

And you can check whether a file is directory by using:
IsDirectory (Dir As String, FileName As String) As Boolean
Thank you but i used this code and it works great:

B4X:
File.MakeDir(File.DirRootExternal, "memoBackup")
    
MyPath = File.DirRootExternal & "/memoBackup/"
    
If File.Exists(MyPath, "") = False Then
        Msgbox("False","")
Else
    Msgbox("True","")
End If
 
Upvote 0
Top