sindresorhus / Actions

⚙️ Supercharge your shortcuts
https://sindresorhus.com/actions
2.65k stars 115 forks source link

Action proposal: Get Folders from Input #151

Closed peavine closed 1 year ago

peavine commented 1 year ago

Description

I wondered if it would be possible to make a Get Folders from Input action, where the input would be paths from a List action (or a Text action). The current solution is to use a Folder action, which works fine, but there are circumstances where it would simplify matters to set the folders as paths in a List action and then to make the paths into a folder where needed. If it makes a difference, I use Shortcuts on macOS.

Thanks for the great app. I'm new to Shortcuts, but I've already put Actions to work in my shortcuts.

sindresorhus commented 1 year ago

Do you need to filter paths that are folders (some paths are files and some are folders and you want the folder paths only) or do you need to get the folders of paths (paths are paths to files and you want the paths to their containing folders)?

If the former, you can use the Get File Path action and then filter based on whether the path ends with /.

peavine commented 1 year ago

Thanks for the quick response. I should have explained better, because I don't believe either of the circumstances you note is what I want to do. I've included a screenshot below that is a very-simplified example. In this example, the first action could be a Folder action but using a list is much easier in the full shortcut.

Actions App

BTW, I mentioned that I'm new to Shortcuts and perhaps I don't fully understand how it works. The following throws an error and that's why I thought an action that makes the path into a folder might be needed.

Actions Example
sindresorhus commented 1 year ago

Ah, I understand now. This is not really possible. Only the system would be able to create a folder object from a path (because of sandboxing).