ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Standard functions / External file functions
  • Example of extracted path
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the different elements of a path: drive, directories, name and extension of the file.
WEBDEV - Server codePHPAjax
sCheminFichier is string
sResNomFichier is string
sResNomChemin is string

sCheminFichier = "C:\MesRépertoires\Fichier.doc"

// Récupération du nom du fichier 
sResNomFichier = fExtractPath(sCheminFichier, fFile)
// sResNomFichier correspond à "Fichier"

// Récupération du disque et du chemin du fichier
sResNomChemin = fExtractPath(sCheminFichier, fDrive + fDirectory)
// sResNomChemin correspond à "C:\MesRépertoires\"
WEBDEV - Server codePHPAjax
// Utilisation de chemins UNC
Trace(fExtractPath("\\lg-br\sharedfiles\downloads\Windev\setup.exe", fDrive))
// Renvoie \\lg-br\sharedfiles
Trace(fExtractPath("\\lg-br\sharedfiles\downloads\Windev\setup.exe", fDirectory))
// Renvoie \downloads\Windev\
Syntax
<Result> = fExtractPath(<File path> , <Path section to extract>)
<Result>: Character string
  • Requested path section,
  • Empty string ("") if an error occurred. To get more details on the error, use ErrorInfo with the errMessage constant.
<File path>: Character string
Name and full or relative path of the file (up to 260 characters). A UNC path can be used. The existence of <File path> is not checked by fExtractPath. If the path does not end with a "\" character, the last element is considered as being a file.
WindowsLinux This parameter can be in Ansi or Unicode format.
<Path section to extract>: Constant or combination of constants
Section of file path to extract:
fDirectoryDifferent file directories (the file name and extension are not returned).
fDriveDrive name.
Linux This constant is not available.
fExtensionFile extension, preceded by "."
fFileFile name (without extension).
Remarks
WEBDEV - Server codePHPAjax

Example of extracted path

If the path specified is "C:\Temp\Data\File.txt", fExtractPath returns:
  • fExtension .txt
  • fFile: File
  • f directory: \Temp\Data\
  • fDisque: C:
  • fFile+fExtension: File.txt
  • fDirectory+fFile: \Temp\Data\File
  • etc.
Component: wd300std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Video FextractPath
https://youtu.be/pOujawO1cVo
https://windevdesenvolvimento.blogspot.com/2019/09/dicas-2291-windev-webdev-mobile.html
// BTN_ABRE_DOCUMENTO
extensao_arquivo is string=fExtractPath(TABLE_ARQUIVOS.COL_ARQUIVO,fExtension)
IF extensao_arquivo=".txt" THEN
ShellExecute(TABLE_ARQUIVOS.COL_ARQUIVO)
ELSE
OpenDocument(TABLE_ARQUIVOS.COL_ARQUIVO)
END
amarildo
15 Sep. 2019

Last update: 03/27/2025

Send a report | Local help