Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Path.LastPathComponent
Queries the last path component.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Path | 6.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example |
---|---|---|
Path | The native file path. | "/Users/cs/Desktop" |
Result
Returns path or error.
Description
Queries the last path component.This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.
Examples
Queries file name:
MBS( "Path.LastPathComponent"; "c:\\test.txt" )
Get file name from container and add to folder path:
Set Variable [$name; Value:GetAsText ( Container Batch Export::Test1 )]
Set Variable [$name; Value:GetValue($name; 1)]
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; $name )]
Set Variable [$dpath; Value:MBS( "Path.AddPathComponent"; $FolderPath; $name )]
Write container to temp file and launch:
# get temp folder
Set Variable [$TempFolder; Value:MBS( "Folders.SystemTemporary" )]
# and file name from container
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; test::myContainer )]
# add name to folder path
Set Variable [$TempPath; Value:MBS( "Path.AddPathComponent"; $TempFolder; $name )]
# now write temp file
Set Variable [$r; Value:MBS( "Files.WriteFile"; test::myContainer; $TempPath)]
# and launch file
Set Variable [$r; Value:MBS( "Files.LaunchFile"; $TempPath)]
See also
- Files.Launch
- Files.LaunchFile
- Files.WriteFile
- MailComposer.AddAttachmentContainer
- MessageComposer.AddAttachmentContainer
- Path.FileMakerPathToNativePath
- Path.RemoveLastPathComponent
- WIA.Image
- WIA.ImageCount
- WIA.ImageDialog
Release notes
- Version 14.0
- Fixed an edge case with Path.LastPathComponent to return last path name, even if a slash is on the end of the path.
Example Databases
- Containers/Container Batch Export
- CURL/Amazon S3/Amazon S3 Upload File
- CURL/Amazon S3/Containers in S3
- Drag and Drop/DragTest Popover
- Drag and Drop/DragTest
- DynaPDF/Shrink PDF pages
- iOS/Examples/iOS Email Sending
- iOS/Examples/Markup
- Mac and iOS/PDFKit/PDFKit Print Documents
- Win Only/WIA Scan
Blog Entries
- MBS Plugin Advent calendar: 7 - Paths
- MBS FileMaker Plugin, version 13.6pr1
- Convert Office Files in FileMaker
- Adding Drag and Drop receiver to a layout
- Storing files for download on FileMaker Server with download URLs
FileMaker Magazin
This function is free to use.
Created 30th November 2015, last changed 20th February 2024