Category filter
Script to Create Files and Folders for Mac
To create a folder on a Mac, the user will have to navigate to the location on the Finder application and click on the context menu option to create a new folder on the location. The user may then rename the folder manually. To create a file, they may have to follow more sophisticated methods. This is tedious for the device administrator when managing endpoints, especially when there are multiple ones. This is also impractical when creating multiple files or folders on a single location or performing a batch operation. On the other hand, using a script to automate this process is easy, efficient and effective. This doc includes a collection of shell scripts that you can run from the Terminal app to open files or folders on a Mac.
Device admins can remotely run scripts on Macs managed with Hexnode using the Execute Custom Script action.
Scripting Language – Bash
File extension – .sh
Create a file
1 |
touch ‘path to file/filename with extension’ |
Example – touch Desktop/document.txt
Create a directory
1 |
mkdir ‘directoryname’ |
Example – mkdir Desktop/My\ Documents