Script to Find File path on Mac
Files can accumulate on the device after a significant period of use, making it difficult to find the correct location of a specific file or folder. On a Mac, the user can view the full location path of the target file by right-clicking on the file and clicking the Get Info option. With a large number of files to be managed, the process becomes a cumbersome task for the admins. Using Hexnode UEM, IT admins can remotely find the file location with just the file name and its extension by executing a custom script on the target endpoint device.
Scripting Language – Bash
File extension – .sh
Find file path
find / -name ‘file name with extension’
find / -name document.txt
‘file name with extension’ with the target file. The Terminal may take several minutes to complete this process. To see the output of the custom script, navigate to Manage > Devices > select your device > Action History and select the Show Output option corresponding to the executed action.
The terminal scans every folder path for the file and logs the search results in this file. Most entries will contain “Operation not permitted” or “Permission denied”, you can safely ignore those lines. To easily identify the target file path from the output logs, search for an entry without the “find” label at the start.