# Function Reference

# _PathSplit

Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing

#include <File.au3>
_PathSplit ( $sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sFileName, ByRef $sExtension )

## Parameters

$sFilePath | The path to be split (can contain a UNC server or drive letter)
$sDrive | String to hold the drive
$sDir | String to hold the directory
$sFileName | String to hold the file name
$sExtension | String to hold the file extension

## Return Value

Returns an array with 5 elements:
$aArray[$PATH_ORIGINAL] = original path
$aArray[$PATH_DRIVE] = drive
$aArray[$PATH_DIRECTORY] = directory
$aArray[$PATH_FILENAME] = filename
$aArray[$PATH_EXTENSION] = extension

## Remarks

This function does not take a command line string. It works on paths, not paths with arguments.

$PATH_ORIGINAL | 0
--- | ---
$PATH_DRIVE | 1
$PATH_DIRECTORY | 2
$PATH_FILENAME | 3
$PATH_EXTENSION | 4

Constants are defined in FileConstants.au3.

## Related

_PathFull, _PathMake

## Example

    #include <Array.au3>
    #include <File.au3>

    Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = ""
    Local $aPathSplit = _PathSplit(@ScriptFullPath, $sDrive, $sDir, $sFileName, $sExtension)
    _ArrayDisplay($aPathSplit, "_PathSplit of " & @ScriptFullPath)