User Tools

Site Tools


dir

Dir

The Qt documentation in C++ of this class (QDir) can be read here: http://doc.trolltech.com/4.4/qdir.html

It is useful to access the file system obtaining information about directories or files and using them.

Implemented since KBasic V1.76.

STATIC METHODS

Create

Static Function Create(Path As String) As Boolean


RecursiveCreate

Static Function RecursiveCreate(Path As String) As Boolean


Remove

Static Function Remove(Path As String) As Boolean


RecursiveRemove

Static Function RecursiveRemove(Path As String) As Boolean


FindFile

Static Function FindFile(Path As String, NameFilter As String, Filter As String = “NoFilter”, Sorting As String = “NoSort”) As Strings

Possible values for Filter are

NoFilter List all.
Dirs List directories that match the filters.
AllDirs List all directories; i.e. don't apply the filters to directory names.
Files List files.
Drives List disk drives (ignored under Unix).
NoSymLinks Do not list symbolic links (ignored by operating systems that don't support symbolic links).
NoDotAndDotDot Do not list the special entries ”.” and ”..”.
AllEntries List directories, files, drives and symlinks (this does not list broken symlinks unless you specify System).
Readable List files for which the application has read access. The Readable value needs to be combined with Dirs or Files.
Writable List files for which the application has write access. The Writable value needs to be combined with Dirs or Files.
Executable List files for which the application has execute access. The Executable value needs to be combined with Dirs or Files.
Modified Only list files that have been modified (ignored under Unix).
Hidden List hidden files (on Unix, files starting with a .).
System List system files (on Unix, FIFOs, sockets and device files)
CaseSensitive The filter should be case sensitive.

Possible values for Sorting are

NoSort
Name Sort by name.
Time Sort by time (modification time).
Size Sort by file size.
Type Sort by file type (extension).
Unsorted Do not sort.
DirsFirst Put the directories first, then the files.
DirsLast Put the files first, then the directories.
Reversed Reverse the sort order.
IgnoreCase Sort case-insensitively.
LocaleAware Sort items appropriately using the current locale settings.

RecursiveFindFile

Static Function RecursiveFindFile(Path As String, NameFilter As String, Filter As String = “NoFilter”, Sorting As String = “NoSort”) As Strings


FindFile

Static Function FindFile(Path As String, NameFilter As Strings, Filter As String = “NoFilter”, Sorting As String = “NoSort”) As Strings


RecursiveFindFile

Static Function RecursiveFindFile(Path As String, NameFilter As Strings, Filter As String = “NoFilter”, Sorting As String = “NoSort”) As Strings


FileList

Static Function FileList(Path As String) As Strings


RecursiveFileList

Static Function RecursiveFileList(Path As String) As Strings


Copy

Static Function Copy(SourcePath As String, DestinationPath As String) As Boolean


Move

Static Function Move(SourcePath As String, DestinationPath As String) As Boolean


Exists

Static Function Exists(Path As String) As Boolean


DateTimeCreatedAsString

Static Function DateTimeCreatedAsString(Path As String) As String


DateTimeUpdatedAsString

Static Function DateTimeUpdatedAsString(Path As String) As String

Returns the last modification time of the contents of a file.


DateTimeReadAsString

Static Function DateTimeReadAsString(Path As String) As String

Returns the last access time of a file.


Owner

Static Function Owner(Path As String) As String


Group

Static Function Group(Path As String) As String


IsReadable

Static Function IsReadable(Path As String, Who As String = “User”) As Boolean

Possible values for Who are

  • User
  • Owner
  • Group
  • Other

IsWritable

Static Function IsWritable(Path As String, Who As String = “User”) As Boolean

Possible values for Who are

  • User
  • Owner
  • Group
  • Other

IsExecutable

Static Function IsExecutable(Path As String, Who As String = “User”) As Boolean

Possible values for Who are

  • User
  • Owner
  • Group
  • Other

IsHidden

Static Function IsHidden(Path As String) As Boolean


IsDir

Static Function IsDir(Path As String) As Boolean


Drives

Static Function Drives() As Strings

Example print all drive names.

Dim ss As Strings = Dir.Drives

For Each s As String In ss
  Print(s) 
Next

TempPath

Static Function TempPath() As String


HomePath

Static Function HomePath() As String

Example

MsgBox Dir.HomePath()

RootPath

Static Function RootPath() As String


WithNativeSeparators

Static Function WithNativeSeparators(Path As String) As String


WithoutNativeSeparators

Static Function WithoutNativeSeparators(Path As String) As String


BundleName

Static Function BundleName(Path As String) As String

Only useful on Mac OS X.


SymLinkTarget

Static Function SymLinkTarget(Path As String) As String


Name

Static Function Name(Path As String) As String


Path

Static Function Path (Path As String) As String


Suffix

Static Function Suffix(Path As String) As String


IsRoot

Static Function IsRoot(Path As String) As Boolean


IsRelative

Static Function IsRelative(Path As String) As Boolean


Static Function IsSymLink(Path As String) As Boolean


IsBundle

Static Function IsBundle(Path As String) As Boolean

Only useful on Mac OS X.


dir.txt · Last modified: 2013/04/09 22:57 (external edit)