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
  • Example of extracted path
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Returns the different elements of a path: disk, directories, name and extension of the file.
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
sFilePath is string
sResFileName is string
sResPathName is string
 
sFilePath = "C:\MyDirectories\File.doc"
 
// Retrieve the name of the file
sResFileName = fExtractPath(sFilePath, fFile)
// sResFileName corresponds to "File"
 
// Retrieve the disk and path of the file
sResPathName = fExtractPath(sFilePath, fDrive + fDirectory)
// sResPathName corresponds to "C:\MyDirectories\"
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)PHPAjax
// Use of UNC paths
Trace(fExtractPath("\\lg-br\sharedfiles\downloads\WINDEV\setup.exe", fDrive))
// Returns \\lg-br\sharedfiles
Trace(fExtractPath("\\lg-br\sharedfiles\downloads\WINDEV\setup.exe", fDirectory))
// Returns \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 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.
AndroidAndroid Widget This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: In Android, the file system is read-only on the device and on the emulator. An application can only write to its setup directory or one of its subdirectories, as well as to the external memory (SDCard).
iPhone/iPadIOS WidgetMac Catalyst This parameter can correspond to a full path or a path relative to the current directory (returned by fCurrentDir). This parameter is case-sensitive.
Reminder: On iPhone/iPad, the file system is read-only on the device and on the emulator. An application can only write to its setup directory or one of its subdirectories.
<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.
LinuxAndroidAndroid Widget iPhone/iPadIOS WidgetMac Catalyst This constant is not available.
fExtensionFile extension, preceded by "."
fFileNameFile name (without extension).
Remarks
WINDEVWEBDEV - Server codeReports and QueriesUniversal Windows 10 AppJavaUser code (UMC)PHPAjax

Example of extracted path

If the path specified is "C:\Temp\Data\File.txt", fExtractPath returns:
  • fExtension: .txt
  • fFileName: File
  • fDirectory: \Temp\Data\
  • fDrive: C:
  • fFileName+fExtension: File.txt
  • fDirectory+fFileName: \Temp\Data\File
  • etc.
AndroidAndroid Widget

Example of extracted path

If the path specified is "\Temp\Data\File.txt", fExtractPath returns:
  • fExtension: .txt
  • fFileName: File
  • fDirectory: \Temp\Data\
  • fFileName+fExtension: File.txt
  • fDirectory+fFileName: \Temp\Data\File
  • etc.
Component: wd290std.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: 09/01/2022

Send a report | Local help