I have a MacAir running El Capitan with all updates. I use a USB stick to move movies from Mac to Samsung Smart TV. The TV writes a hidden file " .device_info_*** " (long abstract filename). This file keeps details of movie folders in it… but does not update. So when I delete a movie… the folder stays hidden on the stick in this file and shows again when connected to the TV. I have created a work around by showing hidden files and deleting this file… the old folder info disappears when viewing on the TV and the TV writes a new file when USB is reinserted. But the whole process starts all over again.
I want to have an auto script that deletes the .device_info_*** file every time the USB is connected to my MacAir – without any user interface or questions about "are you sure, etc" . The asterisks in my example are wildcards because the filenames created are different every time (after the .device_info_ part of the name).
What script would do this? And can wild cards be used as part of the filename in the script?
I am not a script writer but am pretty savvy.
Best Answer
Here's a Keyboard Maestro script that deletes a file when a partition is mounted:
If you want wildcards, it might be more useful to use a script action with rm: