About
URI - Path in a file system.
A file is identified by its path through the file system.
Syntax
A file path is a hierarchical URI
schema://authority/path
where:
- scheme is the scheme that represents the file system such as:
- file (default)
- sftp
- …
- The What is a URI (Uniform resource identifier)? represents the connection information (host, user) such as:
- localhost (default)
- user/password@host:port
- The path represents the file system path and locate the file
Operating System
Os | Root Node | Directory Delimiter in the path | Path Delimiter in the environment_variable |
---|---|---|---|
Windows Path | maps to a volume, such as C:\ or D:\ | back slashes | semicolon (;) |
Unix/Linux | A single root node is supported, which is denoted by the slash character, /. | forward slashes | colon |
Example:
- Unix
/directory1a/directory1b/directory1c/myFile.extension:/directory2a/directory2b/directory3c/myFile
- Windows
C:\directory1a\directory1b\directory1c\myFile.extension:D:\directory2a\directory2b\directory3c\myFile
relative file paths are much more portable.
Note:
- DOS descended file systems are case insensitive
- Windows pretends that all file extensions with four or more letters are also three letter extensions (try DELETE *.jav in your java directories to see a disastrous example of this).
Delimiter
The character used to separate the directory names (also called the delimiter) is specific to the file system.
Unix paths use forward slashes between directories.
Form
Relative or Absolute
A path is either:
- or absolute.
The difference is that an absolute path begins with a prefix (root) while an relative path does not.
Abstract
An abstract pathname has two components:
- An optional system-dependent prefix string
- A sequence of zero or more string names.
The first name in an abstract pathname may be:
- a directory name
- or a hostname (in the case of Microsoft Windows UNC pathnames),
Each subsequent name in an abstract pathname denotes a directory; the last name may denote either a directory or a file.
A pathname, whether abstract or in string form, may be either absolute or relative.
Canonical
The canonical path is both an absolute and unique representation of a file in a file system.
The precise definition of canonical form is system-dependent.
A canonical method first converts the pathname to absolute form if necessary and then maps it to its unique form in a system-dependent way. This typically involves:
- removing redundant names such as “.” and “..” from the pathname,
- resolving symbolic links (on UNIX platforms),
- and converting drive letters to a standard case (on Microsoft Windows platforms).
Prefix
The prefix concept is used to handle:
- root directories on UNIX platforms,
- and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms
Management
Create
Resolve
resolve is an operation that will execute (in a change directory way) all its argument in a serial way to create a path
Example:
join('/b','/c') = '/c'
Join
join is an operation that will join all its argument to create a path
Example:
join('/b','/c') = '/b/c'
Parsing
oracle: The second element of a path. See Oracle Database - SQL - Regular expression
REGEXP_REPLACE(path, '(/[^/]+)/([^/]+)(.*)','\2')