Created
April 29, 2013 08:28
-
-
Save tzarskyz/5480367 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- get path of Finder window | |
tell application "Finder" | |
try | |
set finder_window to window 1 | |
on error | |
error "There are no Finder windows" | |
end try | |
set start_path to POSIX path of (target of window 1 as alias) | |
end tell | |
-- get user input | |
display dialog "Glob expression" default answer "*.md" | |
-- get matching files | |
try | |
set posix_matches to do shell script "ls -d " & ¬ | |
quoted form of start_path & text returned of result | |
on error | |
return | |
end try | |
-- convert each path string to alias | |
set matches to {} | |
repeat with match in paragraphs of posix_matches | |
set matches to matches & (POSIX file match) | |
end repeat | |
-- select the matches | |
tell finder_window | |
activate | |
select matches | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment