Select Folder on Mac

With the example below you can select a Folder in a browse dialog and also set the Root folder. In this example it will always open on the Desktop, see the commented line in the code to use a fixed path. Note : if you want to use a fixed path use the / as separator. When you click on Choose in the Browse dialog it will return the path of the selected folder.


If you want to add your own path for the Root folder, use this tip so you not have to type the path yourself :

First show the Path Bar in Finder, you must do this one time :
  1. Open Finder
  2. Click on View in the Finder Toolbar
  3. Click on Show Path Bar
Open the folder in Finder and right click on the folder name in the Path Bar and choose Copy "YourFolderName" As Pathname
06/12/2024
Web design by Will Woodgate