Home

FILEPATH

A filepath is a textual identifier that specifies the location of a file or directory within a computer filesystem. It encodes a sequence of directory names that an operating system uses to locate the target item, and it can be absolute, covering the full path from the root, or relative, resolving from the current working directory.

Syntax and separators vary by operating system. In Unix-like systems, components are separated by forward slashes

A path consists of components such as directories and a final element that may be a filename

Normalization and resolution convert a path into a canonical form by removing redundant separators and resolving

Security and portability considerations are important when handling filepaths. Untrusted input can lead to directory traversal

and
an
initial
slash
denotes
the
root.
Windows
uses
backslashes
(though
forward
slashes
are
often
accepted)
and
may
begin
with
a
drive
letter
(for
example
C:).
UNC
paths
begin
with
double
backslashes
to
reference
shared
network
resources.
with
an
extension.
Special
components
like
.
and
..
represent
the
current
and
parent
directories.
Some
shells
and
languages
support
tilde
expansion
for
home
directories,
but
the
tilde
is
not
part
of
the
path
itself.
symbolic
links
or
relative
components.
Functions
such
as
realpath
or
normpath,
abspath,
and
path
joins
aid
in
safe
handling
and
portability.
vulnerabilities.
Validate
paths,
constrain
access
to
a
base
directory,
and
prefer
library
routines
that
normalize
and
securely
join
path
segments
rather
than
simple
string
concatenation.