Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
12.0
12.1
12.2
12.3
12.4
12.5
13.0
13.1
13.2
13.3
Statistic
FMM
Blog
Path.AddPathComponent
Adds a new 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" |
Component... | The new path component. | "Hello" |
Result
Returns path or error.
Description
Adds a new path component.The path provided as parameter does not need to end with a slash or backslash.
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.
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.
Please repeat Component parameter as often as you need.
Examples
Adds a path component to a path:
MBS( "Path.AddPathComponent"; "/Users/cs/Desktop"; "Hello" )
Adds a file name:
MBS( "Path.AddPathComponent"; "/Users/cs/Desktop/"; "test.txt" )
Adds a file path on Windows:
MBS( "Path.AddPathComponent"; "c:\\Test"; "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 )]
Create folder on Desktop:
Set Variable [$folder; Value:MBS( "Folders.UserDesktop" )]
If [IsEmpty(Container Export::Name)]
Set Field [Container Export::Name; "Record " & Get(RecordID)]
End If
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; $folder; Container Export::Name )]
Set Variable [$r; Value:MBS("Files.CreateDirectory"; $path)]
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)]
Add multiple path componennts:
MBS( "Path.AddPathComponent"; "/Users/cs/Desktop"; "Hello"; "World"; "test" )
Example result: /Users/cs/Desktop/Hello/World/test
Export a container to desktop:
# get path stored in the container field
Set Variable [ $ContainerPath ; Value: GetAsText ( Contacts::Photo Container ) ]
# get the file name portion
Set Variable [ $ContainerName ; Value: MBS( "Path.LastPathComponent"; $ContainerPath ) ]
# take a folder on the computer, e.g. desktop
Set Variable [ $DesktopFolder ; Value: MBS( "Folders.UserDesktop" ) ]
# build path with file name on that folder
Set Variable [ $FilePath ; Value: MBS( "Path.AddPathComponent"; $DesktopFolder; $ContainerName ) ]
# and export the content of container to that path
Set Variable [ $r ; Value: MBS( "Container.WriteFile"; Contacts::Photo Container; $FilePath ) ]
See also
- Path.LastPathComponent
- Text.ReadTextFile
- Trace
- Trace.SetWithTimes
- WebView.Create
- WordFile.AppendTableRow
- WordFile.ReplaceTag
- XL.Book.DeleteSheet
- XL.LoadBook
- XL.Sheet.RemoveRow
Release notes
- Version 9.4
- Changed Path.AddPathComponent to accept multiple parameters.
Example Databases
- CURL/FTP/CURL FTP Download all Files in Directory
- DynaPDF/Scan with WIA to PDF
- DynaPDF/Shrink PDF pages
- GraphicsMagick/Create GIF
- GraphicsMagick/Create Multi Tiff
- Mac only/Movies/AVAsset Export Session
- SmartCard/SmartCard Signatures
- Text functions/Write Text File
- Win Only/Snippets for Windows
- WordFile/WordFile
Blog Entries
- New in MBS FileMaker Plugin 13.1
- Build archives on the fly
- Convert Office Files in FileMaker
- Recursive Folder Copy Script
- New in MBS FileMaker Plugin 11.3
- Query MBS Version from plugin in container
- Combined Components with MBS FileMaker Plugin
- Using TLS when connecting to MySQL server
- Define hot keys for functions in the FileMaker development
- Storing files for download on FileMaker Server with download URLs
FileMaker Magazin
This function checks for a paid license.
Created 30th November 2015, last changed 5th June 2021
PageSetupDialog.SetScalingFactor - Path.FileMakerPathToNativePath
