File Path and Identifier Functions
- See also: Expression Language and Function Index
The functions in this section provide specific file-related information such as a file's name, path, volume, and other Media Center internal information.
DBLocation(…)
- Identifies a file's databases.
Description | DBLocation()
DBLocation() behaves exactly as FileDBLocation(0), and takes no parameters, returning only a semicolon-separated list of formatted database names. |
---|---|
Examples | See FileDBLocation() |
Enviro(…)
- Returns a specified host system variable
Description | Enviro(System_Variable)
Enviro() will lookup a given system variable and return its full path or contents. Note that the function only requires the variable name, bookended % signs are not necessary. |
---|---|
Examples | Enviro(SystemRoot)
Enviro(SystemDrive)
|
FileDBLocation(…)
- Identifies a file's databases.
Description | filedblocation(format)
The FileDBLocation() function returns identifiers in the specified format that indicate to which internal database(s) a file belongs. Media Center maintains several internal databases to track a file's disposition. This function is primarily for technical use only, and will have little utility for most users. Available format values:
The table below provides common values output from FileDBLocation():
Argument format is optional (defaults to 0). | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Examples | filedblocation()
For a file in the Main and Other (4096) databases, the result would be Main; Other (4096). filedblocation(1) The result from the same file would be 4096 (bit 0 and bit 12 set). Additional Examples |
FileFolder(…)
- Returns the name of a file's parent.
Description | filefolder(filepath, level)
The FileFolder() function returns parent sub-folder name for filepath. The level argument specifies which parent sub-folder name to return, working the filepath from right-to-left (i.e. bottom of the folder tree upwards to the top). A value of 0 specifies a file's immediate parent, 1 its grandparent, etc., up to the root of the filepath. A value of Unassigned will be returned when the specified level exceeds the root of the filepath. Argument filepath is optional (defaults to [filename]). Argument level is optional (defaults to 0). |
---|---|
Examples | filefolder()
Returns the name of the file's parent folder. filefolder([filename,0], 0) Same as the previous example. filefolder(c:\some\folder\for\a\file.ape, 2) Returns the great grandparent sub-folder named folder. filefolder(c:\some\other\folder\a\, 2) Returns the folder named other. Notice the file name is not required in the filepath. FileFolder() works by looking from the end of the filepath until it finds a backslash \. |
FileKey(…)
- Returns a file's unique internal identifier.
Description | filekey()
The FileKey() function returns the unique identifier associated with a file. Media Center assigns a unique identifier to each file in the Library. It is useful in expressions when referring to individual files is necessary. Services such as MCWS use this value to reference a file. |
---|---|
Examples | filekey()
Returns a integer value, such as 22029495, unique for each file in the Library. |
FileLookup(…)
- Looks up a file from its filename
Description | FileLookup(Filename)
FileLookup() will lookup a file from a given filename, returning its assigned #FileKey |
---|---|
Examples | FileLookup([filename])
FileLookup(C:\Track /(Test/))
|
FileName(…)
- Returns a file's name component.
Description | filename(filepath, include suffix)
The FileName() function returns the file name part of filepath. Inclusion of the file's suffix depends on the include suffix argument.
Argument filepath is optional (defaults to [filename]). Argument include suffix is optional (defaults to 1). | ||||
---|---|---|---|---|---|
Examples | filename(C:\Music\File.mp3)
The output is File.mp3. filename(C:\Music\File 2.wav, 0) The output does not include the file suffix, and is File 2. filename() Returns the value contained in the field [filename (name)]. |
FilePath(…)
- Returns a file's path component.
Description | filepath(filepath)
The FilePath() function will return the path portion of the specified file path. The filepath should be a rooted path. For Windows, this includes the drive letter or leading \\ for UNC paths. For *nix-based systems, this includes the root /. The field [filename (path)] is equivalent to FilePath(), and is generally preferred. Argument filepath is optional (defaults to [filename]). |
---|---|
Examples | filepath(C:\Music\File.mp3)
Returns C:\Music. filepath() Returns the value contained in the field [filename (path)]. |
FileVolume(…)
- Returns a file's volume name component.
Description | filevolume(filepath)
The FileVolume() function returns the volume name component of the specified file path. The path should be a rooted path (see the same comment above for FilePath(). For *nix-based systems, the output is empty. The field [volume name] is equivalent to FileVolume(), and is generally preferred. Argument filepath is optional (defaults to [filename]). |
---|---|
Examples | filevolume(C:\Music\File.mp3)
Outputs C:. filevolume() Returns the value contained in the field [volume name]. |