As described in my article IntelliJ live templates with Symfony3, I always try to simplify or completely automate recurring efforts you have to deal with as a software developer. So here I describe a solution for the fact that I as a user of the IntelliJ development environment have to struggle around with innumerable, quickly created scratch files whose content has already become obsolete.
Since I am used to empty these "note files", which are automatically generated by pressing ⇧ , ⌘ and N when code is selected, most of the time only a file with a name like
scratch_6.yml will remain on my computer. The deletion of the file itself is usually lost in the heat of the moment.
#!/bin/sh cd $(dirname $0) find . -size 0 -print0 |xargs -0 rm exit 1
By clicking on the file, all empty scratch files should now be deleted automatically. If this does not work, it might help to adjust the permissions of the file accordingly:
chmod a+x delete-empty-scratches.command . The saved time can then be used to check the remaining files and their contents for relevance, to then delete them or use them otherwise.