Filename API Functions: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Zeile 67: Zeile 67:
Example:
Example:
'/etc' asFilename files
'/etc' asFilename files
=> #( ... )

===== filesMatching:[caseSensitive:] =====
Returns a collection of all files in a directory (folder) whose name matches given GLOB pattern. The returned collection will not include names of subdirectories.
The pattern may consist of multiple GLOB patterns, separated by semicolon.

''aFilename'' '''filesMatching:''' ''multiPattern''
''aFilename'' '''filesMatching:''' ''multiPattern'' caseSensitive: ''boolean''
''aFilename''.'''filesMatching'''(''multiPattern'') [JS]

Example:
'/etc' asFilename filesMatching: 'a*'
=> #( ... )
'/etc' asFilename filesMatching: 'a*;b*;x*'
=> #( ... )
'/tmp' asFilename filesMatching: '*.dat;*.txt'
=> #( ... )
=> #( ... )



Version vom 28. Juli 2019, 09:51 Uhr

This document lists most useful (and most often needed) functions. Be aware, that there are many more to be found in either the class references or via the builtin class browser.

Reference: Filename

Back to Useful API Functions

Queries[Bearbeiten]

exists[Bearbeiten]

Returns true if the file exists.

aFilename exists

aFilename.exists() [JS]

Example:

 'data.txt' asFilename exists
 => false
isReadable / isWritable / isExecutable[Bearbeiten]

Returns a boolean.
Notice that ïsExecutable" has a special meaning for folders (refer to your Unix/Windows operating system manual).

aFilename isReadable

aFilename.isReadable() [JS]

Example:

 'data.txt' asFilename isReadable
 => false
fileSize[Bearbeiten]

Returns the file's size (in bytes). 0 if it does not exist (or is empty).

aFilename fileSize

aFilename.fileSize() [JS]

Example:

 'data.txt' asFilename fileSize
 => 0
modificationTime / creationTime / accessTime[Bearbeiten]

Returns the time of the last modification, initial creation and last access of the file. Notice that Unix operating systems do not record a file's creationTime. There, the nil will be returned for creationTime.

aFilename modificationTime

aFilename.modificationTime() [JS]

Example:

 '/etc' asFilename modificationTime
 => 2018-07-27 11:37:20

 'c:\tmp\test.dat' asFilename modificationTime
 => 2010-01-27 22:37:20

Directory Contents[Bearbeiten]

files[Bearbeiten]

Returns a collection of all files in a directory (folder). The returned collection will not include names of subdirectories.

aFilename files

aFilename.files() [JS]

Example:

 '/etc' asFilename files
 => #( ... )
filesMatching:[caseSensitive:][Bearbeiten]

Returns a collection of all files in a directory (folder) whose name matches given GLOB pattern. The returned collection will not include names of subdirectories. The pattern may consist of multiple GLOB patterns, separated by semicolon.

aFilename filesMatching: multiPattern

aFilename filesMatching: multiPattern caseSensitive: boolean

aFilename.filesMatching(multiPattern) [JS]

Example:

 '/etc' asFilename filesMatching: 'a*'
 => #( ... )

 '/etc' asFilename filesMatching: 'a*;b*;x*'
 => #( ... )

 '/tmp' asFilename filesMatching: '*.dat;*.txt'
 => #( ... )
directories[Bearbeiten]

Returns a collection of all sub directories in a directory. The returned collection will not include names of regular files.

aFilename directories

aFilename.directories() [JS]

Example:

 '/etc' asFilename directories
 => #( ... )



Copyright © 2014-2024 eXept Software AG