Unable to create directory

johnb4a

Member
Licensed User
Longtime User
Hi,

I am trying to make a directory and copy a file. but it is giving me an error.

java.io.filenotfoundexception:/storage/sdcard0/appfiles/Share.txt: open failed: ENOENT (NO SUCH FILE OR DIRECTORY).

I have added the Share.txt file inside files folder.

below is my sample code.

Any one please help me.



'Activity module
Sub Process_Globals
Dim Dir As String : Dir = File.DirRootExternal & "/appfiles"
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.

End Sub

Sub Activity_Create(FirstTime As Boolean)
If FirstTime AND File.Exists(Dir, "*.*") = False Then
File.MakeDir(File.DirRootExternal, "appfiles")
If File.Exists(Dir, "Share.txt") = False Then
File.Copy(File.DirAssets, "Share.txt", Dir, "Share.txt")
End If
End If

File.WriteString(File.DirRootExternal, "Share.txt", "Some text")

End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
 

kalarius

Active Member
Licensed User
Longtime User
hi,

it is possible the /storage/sdcard0 to be write lock and you can read only the files.
Download from google play the Fx explorer and then goto to /storage/sdcard0 to make a folder
If it make the folder then you have read/write permissions
if you see the message that no permission to write then from Fx goto down to options and add the fx root (it is free addon) with this you will change the permissions to sdcard0 >> w/r

If your device have an internal sdcard then the external is locked for write by the google android and must change the permissions to w/r
 
Upvote 0
Top