Updated it to NewPath, with support for both files and directories. See the top post for the new way of handling it. You can download it now or wait for the auto-update to kick in.
dir_path="$(osascript -l JavaScript -e '
const frontmost_app_name = Application("System Events").applicationProcesses.where({ frontmost: true }).name()[0]
if (frontmost_app_name === "Finder") {
decodeURIComponent(Application("Finder").insertionLocation().url()).slice(7).slice(0, -1)
} else if(frontmost_app_name === "Path Finder") {
decodeURIComponent(Application("Path Finder").finderWindows[0].target.url()).slice(7).slice(0, -1)
} else {
decodeURIComponent(Application("Finder").desktop.url()).slice(7).slice(0, -1)
}
')"
IFS=$'/\n'
for dir in ${@}; do
dir_location="${dir_path}/${dir}"
mkdir "${dir_location}"
if [[ "${open_dirs}" == 'yes' ]]; then open "${dir_location}"; fi
done
Note that I also changed the variable names in the Arg and vars utilities from open_files to open_dirs.
Will later look into enabling syntax that directories can be created using native mkdir syntax such as (nd is the Alfred command for creating the new directories):
nd Dir1 'Dir 2' "Dir 3" Dir{4,5,6} Dir{7..100}
to create below directories in current foremost directory:
Dir1
Dir 2
Dir 3
Dir 4
Dir 5
Dir 6
Dir 7
...
Dir 100