Created
February 19, 2012 20:47
-
-
Save pix0r/1865701 to your computer and use it in GitHub Desktop.
Delete *.m3u and *.pls under current Finder directory
This file contains 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
-- Path of script: | |
-- tell application "Finder" to get POSIX path of ((container of (path to me)) as text) | |
-- Foreground Finder window: | |
tell application "Finder" to get POSIX path of ((the target of the front window) as text) | |
set currDir to quoted form of result | |
set cmdBase to "find " & currDir & " \\( -name \\*.m3u -or -name \\*.pls \\)" | |
set cmdList to cmdBase & " -exec basename {} \\;" | |
set cmdCount to cmdBase & " | wc -l" | |
set cmdDelete to cmdBase & " -exec rm -f {} \\;" | |
set fileList to (do shell script cmdList) | |
set fileCount to (do shell script cmdCount) as integer | |
if (fileCount = 0) then | |
display dialog "No playlist files found" buttons {"OK"} | |
else | |
set message to "Delete " & fileCount & " playlist files?" | |
display dialog message | |
do shell script cmdDelete | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment