found on the Applescript forum the following script’
tell application "Finder"
delete (every file of (choose folder) whose name contains ".-")
empty trash -- comment out to be sure not to delete wrong files
end tell
That works very well. But need to change it so I can use it in a automator workflow. So that it looks in the current folder (and not asking to choose a folder) from the workflow and deletes all files with the extension .NEF.
So did the folowing…but this doesn’t work I have no clue why
on run {input, parameters}
tell application "Finder"
delete (every file whose name ends with ".NEF")
empty trash -- comment out to be sure not to delete wrong files
end tell
return input
end run
Anyone knows whats wrong?
Thanks and have a nice weekend
Bob
ps know there are some actions in automator that can do the same but for some reasons those do not work for me
on run {input, parameters}
tell application "Finder"
delete (every file whose name extension is "NEF")
--empty trash -- comment out to be sure not to delete wrong files
end tell
return input
end run
strange thing is that following script does it great (as mentioned above)
tell application "Finder"
delete (every file of (choose folder) whose name contains ".NEF")
empty trash -- comment out to be sure not to delete wrong files
end tell
mmmmmm… is it possible that I change that script in something like - know it doesn’t work but think you know what I mean;
tell application "Finder"
delete (every file of (CURRENT folder) whose name contains ".NEF")
empty trash -- comment out to be sure not to delete wrong files
end tell
so that not have to choose in the workflow but that it look in the current folder automaticly
Creating a workflow that deletes specific files from a folder passed from a previous action is pretty straighforward, here’s the list of actions in the workflow:
action 1 – some action that passes a folder references such as: Ask for Finder Items OR ignore this step and save the workflow as a Finder plugin then select a folder from the desktop and run the workflow. A reference to the selected folder will automatically be passed to the first action in the workflow
action 2 - Get Folder Contents
action 3 - Filter Finder Items
action 4 - Move to Trash
BTW, if you write script using the Run AppleScript action, rember that the items from the previous action are passed in the input variable:
on run {input, paramters}
tell application "Finder"
delete every document file of input whose name extension is "NET"
end tell
end run
You have folder that’s containing an original .NEF file
A folder with some actions you w’ll probably need
4 workflows
Workflow A:
This workflow works. You can test it on the original folder. The .NEF file will be deleted. But you have the .zip file so you can grap a new .NEF file for the other worklfows.
Workflow B:
Put workflow A in a excisting workflow (work in progress) and the strange thing is that now it doesn’t work anymore. So had to implement the option that it asks for the user to select again a folder but that last step I do not want…
Workflow C:
Did a applescript in this workflow…and does not work, and have no clue why
Workflow D:
This contains a applescript and works fantastic but again it asks for a folder and I do not want that.