The filesystem module allows you to inspect and modify files on the filesystem. More...
| Constants: |
|
| Functions: |
|
The filesystem module is currently only available for the android, ios, win8, glfw and stdcpp targets.
#If TARGET<>"android" And TARGET<>"ios" And TARGET<>"winrt" And TARGET<>"glfw"#Error "Invalid target"#EndifImport mojoImport brl.FileSystemClass MyApp Extends App Method OnCreate() DeleteDir "monkey://internal/dir1",True DeleteDir "monkey://internal/dir2",True DeleteDir "monkey://internal/dir3",True CreateDir "monkey://internal/dir1" CreateFile "monkey://internal/dir1/file1" CreateFile "monkey://internal/dir1/file2" CreateDir "monkey://internal/dir1/dir2" CreateFile "monkey://internal/dir1/dir2/file5" CreateDir "monkey://internal/dir2" CreateFile "monkey://internal/dir2/file3" CreateFile "monkey://internal/dir2/file4" CopyDir "monkey://internal/dir1","monkey://internal/dir3",True DeleteFile "monkey://internal/dir1/file1" DeleteFile "monkey://internal/dir3/dir2/file5" SetUpdateRate 60 End Method OnUpdate() End Method OnRender() Scale 2,2 Cls Local y:=0 For Local f:=Eachin LoadDir( "monkey://internal/",True ) Local p:="monkey://internal/"+f Local nm:=(f+" ")[..20] Local ty:="" If FileType( p )=FILETYPE_FILE ty=FileSize( p ) Else ty="(dir)" Endif DrawText nm+ty,0,y y+=12 Next EndEndFunction Main() New MyApp EndCopies the directory at srcpath to dstpath, creating dstpath if necessary.
If recursive is True, then subdirectories are also copied.
If hidden is True, then hidden files - files starting with a dot - are also copied.
Returns True if the directory was successfully copied.
Copies a file from srcpath to dstpath.
Returns True if the file was successfully copied.
Create a new directory at path.
Returns True if the directory was successfully created.
Creates a new file at path.
If the file already exists, it's contents are discarded and a new empty file is created.
Returns True if the file was successfully created.
Deletes the directory at path.
If recursive is True, then subdirectories are also deleted - use with care!
If recursive if False and the directory contains files, DeleteDir will fail.
Returns True if the directory was successfully deleted.
Deletes the specified file.
Returns True if the file was successfully deleted.
Return the length of a file, in bytes, or 0 if the file does not exist.
Return the time the file was last modified, or 0 if the file does not exist.
The returned value is the number of seconds since Jan 1 1970.
Returns an integer representing the type of a file, one of: FILETYPE_NONE for no file, FILETYPE_FILE for a normal file, FILETYPE_DIR for a directory.
Loads the file names in the directory specified by path into a string array.
If recursive is True, LoadDir will also load file and directory names in subdirectories.
If hidden is True, then hidden files - files starting with a dot - are also loaded.