2
\$\begingroup\$

After a March update, Adobe Indesign will resurrect removed directories it was responsible for creating in the first place, but not any files except for one file called "AdobeFnt.lst". So where once you had a complex folder structure, but then deleted it, you'll now have the whole structure back, but one folder somewhere will contain AdobeFnt.lst (and since it's MacOS, perhaps some .DS_Store files). My mother complained about this, and so I offered to write her a script that will check every minute for these resurrected empty directories. I wrote what's below, for addition to her crontab, but am afraid of deleting things incorrectly.

Would this safely do the job? She saves these InDesign packages to her Desktop, and I was going to tell her to add all folders she saves stuff to into the DIRS array at the top.

#!/bin/bash

# List where you save InDesign packages
DIRS=(
    "$HOME/Desktop"
)


IFS=$'\n'
for DIR in "${DIRS[@]}"; do
    DS=($(find "$DIR" -type d -maxdepth 1 -mindepth 1))
    for D in "${DS[@]}"; do
        FS=($(find "$D" -type f ! -iname .DS_Store))
        if [ ${#FS[@]} -eq 1 ] && [ $(basename "${FS[0]}") = "AdobeFnt.lst" ]; then
            echo "Removing $D"
            rm -r $D 
        fi
    done
done
```
\$\endgroup\$

0

Browse other questions tagged or ask your own question.