I want to use a script to move invisible files to the trash and then empty the trash.
I have got a script to work ok with visibal files (you’re right it isn’t rocket science!) but a ‘can’t find’ error is returned if I identify and invisible file. How do I specify and invisible file please?
As far as I know, Finder doesn’t mess with invisible files. If you aren’t opposed to using the shell (wrapped in AppleScript), here’s a snippet that I use to immediately delete (not move to the trash) a list of files.
repeat with file_ in files_ -- files_ is an alias list
do shell script "rm " & quoted form of POSIX path of file_
end repeat
– Rob
No, the Finder can certainly handle hidden files. The thing about moving them to the trash is that if the trash only contains hidden files (or just a single hidden file), it won’t register as being full so you have to add some non-hidden file or folder to the trash and then empty it. Doing his will delete the hidden file as well as the other contents of the trash. Here’s code for just moving a hidden file to the trash (first I create a hidden file and then delete it–you can hear the satisfying sound of the Finder moving an item to the trash if you have your volume up):
Jon
[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]