Hi, everyone
I am quite green when it comes to AppleScript, but not scripting and programming as such. So AppleScripts syntax is a bit confusing to me.
I want to make a droplet that removes all files that start with ._ on drives and folders. These files ar such a pain when moving things to PC drives.
I started with Apples droplet examples as a blueprint since they do pretty much all I want. The example can be found here:
http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.09.htm
I used the second one (nested folders example). I have two questions about this example and the way it works.
- The alias that is passed to “process_item” does not take “delete (the original of this_item)” as a statement. It can not access the original of the alias. I have tried using different syntaxes and versons but no luck. What is passed here? And how do I write something that can alter the file is is refering to?
I first worked around this by using:
set myfile to the quoted form of the POSIX path of this_item
do shell script "rm -f " & myfile
but then comes problem number 2…
- This is even worse for me. The script can not find the hidden ._ files I want to delete. I have altered the following:
from: the name extension of the item_info is in the extension_list )then
to: the name of the item_info starts with “._”) then
in both places in the script.
from: set these_items to list folder this_folder without invisibles
to: set these_items to list folder this_folder with invisibles
Searching for files that start with “test” or similar works. I also tried to simply bypass most of the script by adding:
delete (every file of this_folder whose name starts with ".")
at the top of “process_folder”. This generated similar errors that the delete statement above gave. Working around this with do shell script does not work since the script halts if one of the folders is without . files.
The only consistency I can find is that it is the file / folder references that can not be used the way I think they can be used. Can someone help me untangle this mess a little bit?