C cnicolapc Active Member Licensed User Longtime User Aug 25, 2011 #1 hi, How can I do to check if a DIR Exist on sd card and avoid the error if I try to open a file? Thank You in advance I tried so but I always return false Code: Copy If File.Exists(File.DirDefaultExternal& "/memoBackup/","*.*")=True Then Msgbox("True","") Else Msgbox("False","") End If Nicola Last edited: Aug 25, 2011
hi, How can I do to check if a DIR Exist on sd card and avoid the error if I try to open a file? Thank You in advance I tried so but I always return false Code: Copy If File.Exists(File.DirDefaultExternal& "/memoBackup/","*.*")=True Then Msgbox("True","") Else Msgbox("False","") End If Nicola
margret Well-Known Member Licensed User Longtime User Aug 25, 2011 #2 Checking Directory I don't use the second parameter if I am checking for a directory. I use this: Code: Copy MyPath = File.DirRootExternal & "/My Files/Pictures/Xmas" If File.Exists(MyPath, "") = False Then Your Code . . . . . End If Upvote 0
Checking Directory I don't use the second parameter if I am checking for a directory. I use this: Code: Copy MyPath = File.DirRootExternal & "/My Files/Pictures/Xmas" If File.Exists(MyPath, "") = False Then Your Code . . . . . End If
C cnicolapc Active Member Licensed User Longtime User Aug 25, 2011 #3 Hi, thanks again, you have been a great help to me Nicola Upvote 0
C cnicolapc Active Member Licensed User Longtime User Aug 25, 2011 #4 hi, I tried so, but if DIR memoBackup Exist on SD return FALSE and If I DELETE memoBackup DIR on SD I still return FALSE. What can it be? yet the path is right. Code: Copy MyPath = File.DirRootExternal & "/memoBackup/" If File.Exists(MyPath, "") = False Then Msgbox("False","") Else Msgbox("True","") End If Thank Again Nicola Upvote 0
hi, I tried so, but if DIR memoBackup Exist on SD return FALSE and If I DELETE memoBackup DIR on SD I still return FALSE. What can it be? yet the path is right. Code: Copy MyPath = File.DirRootExternal & "/memoBackup/" If File.Exists(MyPath, "") = False Then Msgbox("False","") Else Msgbox("True","") End If Thank Again Nicola
K Kamac Active Member Licensed User Longtime User Aug 25, 2011 #5 "/memoBackup/" Click to expand... Try "memoBackup/" Click to expand... Upvote 0
margret Well-Known Member Licensed User Longtime User Aug 25, 2011 #6 Dir Info The code you have listed is correct. Android is case sensitive and you need to make sure that the directory when you created it is memoBackup and not memobackup. If you use the code I listed you must have the "/" at the beggining of the path/filename after the File.DirRootExternal, however, the "/" is not needed at the end of the path. I ran the code below and it works fine: Code: Copy File.MakeDir(File.DirRootExternal, "memoBackup") MyPath = File.DirRootExternal & "/memoBackup/" If File.Exists(MyPath, "") = False Then Msgbox("False","") Else Msgbox("True","") End If Margret Last edited: Aug 25, 2011 Upvote 0
Dir Info The code you have listed is correct. Android is case sensitive and you need to make sure that the directory when you created it is memoBackup and not memobackup. If you use the code I listed you must have the "/" at the beggining of the path/filename after the File.DirRootExternal, however, the "/" is not needed at the end of the path. I ran the code below and it works fine: Code: Copy File.MakeDir(File.DirRootExternal, "memoBackup") MyPath = File.DirRootExternal & "/memoBackup/" If File.Exists(MyPath, "") = False Then Msgbox("False","") Else Msgbox("True","") End If Margret
C cnicolapc Active Member Licensed User Longtime User Aug 25, 2011 #7 hi, Sorry guys, I'm an idiot I made a copy and paste the example of Margret and I have not checked my DIR is in file.DirDefaultExternal and not in file.DirRootExternal. Forgive me if I wasted your time, now it all works, thanks. Nicola Upvote 0
hi, Sorry guys, I'm an idiot I made a copy and paste the example of Margret and I have not checked my DIR is in file.DirDefaultExternal and not in file.DirRootExternal. Forgive me if I wasted your time, now it all works, thanks. Nicola
JesseW Active Member Licensed User Longtime User Aug 25, 2011 #8 It was not a waste of time. I learned something from it that's why we're all here Upvote 0