thomaskekeisen.de

From the life of a screen worker

Attention: This page contains partner and advertising links. Therefore this page is to be understood entirety as an advertisement!

Reduce unnecessary workload

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_13.txt or scratch_6.yml will remain on my computer. The deletion of the file itself is usually lost in the heat of the moment.

Automated deletion using a bash script

With the following bash script, which is also contained in my scratch files folder, all empty files are automatically deleted:

            delete-empty-scratches.command
            
                #!/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.

Share

Comments