HomeAppletrash - How do I delete .Trashes utilizing an applescript app, drawback...

trash – How do I delete .Trashes utilizing an applescript app, drawback with Full Disk Entry permssion


I switch a whole lot of knowledge to my mac utilizing SD playing cards from video and audio tools. The SD playing cards are mounted as disks (or volumes, no matter you need to name them) and displayed on the Desktop. After importing I want a solution to empty the trash on the person SD playing cards with out emptying the trash on all disks so I created an app that allowed me to tug the icon for an SD card to the app, the app would extract the identify of the SD card and launch a shell script which recursively eliminated .Trashes on the SD card and solely the SD card.

This labored high quality till just lately once I realized that it wasn’t deleting something. There have been no error messages, the playing cards simply crammed up and on a video shoot I used to be unexpectedly not in a position to report new video on them.

I stripped down the script to the next which demonstrates the foundation of the issue:

The next line is entered into script editor, compiled and saved as an app:

do shell script "rm -rf "/Volumes/SD_CARD_NAME/.Trashes"

Full Disk Entry permission is given to Script Editor, the app and Terminal.

If I run the script from script editor, .Trashes is eliminated

If I enter the script within the Terminal command line, .Trashes is eliminated

If I run the app by clicking on the icon for the app, .Trashes is just not eliminated and I get the next error:

rm:/Volumes/SD_CARD_NAME_/.Trashes: Operation not permitted (1)

And, after working the app (by clicking on it) Full Disk Entry for the app has been disabled by the system!

I suppose my first query is, How can I maintain Full Disk Entry from being reset for the app?

And my second query, if there’s not a solution to maintain it from being reset, is there one other solution to create an app that lets me empty the trash on a quantity with out emptying the trash on all volumes? I do know that I can enter the command in Terminal, however this is able to be harmful as a result of a typo may find yourself deleting recordsdata that should not be deleted, plus it is an actual nuisance when you’re coping with a dozen or so SD playing cards.

any assist can be a lot appreciated.

I’m working Ventura 13.3.1 on a mac Mini M1.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments