Floating.Point Posted August 7, 2023 Share Posted August 7, 2023 Howdy, I want a conditional to check if my current selection in Finder is a folder or not. The only way I could come up with was checking the extension and if the result is blank, then I assume it is a folder. Just wondering if there's a better way to do this? Link to comment
Stephen_C Posted August 7, 2023 Share Posted August 7, 2023 One way might be to use the automation task Filter Paths for Folders—which will return the path of a selected folder but nothing if a file, instead of a folder, is selected. Stephen Link to comment
vitor Posted August 8, 2023 Share Posted August 8, 2023 (edited) 19 hours ago, Floating.Point said: Just wondering if there's a better way to do this? Checking for an extension isn’t reliable because files can be extensionless. @Stephen_C’s solution is clever and should work, but I’ll add proper checks for “Is File?” and “Is Folder?” for the next Automation Tasks release. In the meantime, you can use a Run Script with default settings and code: [[ -d "${1}" ]] && echo -n 'true' || echo -n 'false'. That will be true if a folder and false if not. Edited August 8, 2023 by vitor Floating.Point 1 Link to comment
Floating.Point Posted August 8, 2023 Author Share Posted August 8, 2023 Ah of course files can lack extensions 🤦♂️ Temporary script solution works perfectly, thank you both for the help 😊 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now