After a PR was submitted (#6 Making icon count dynamic), which removes the hard coded icon count with a dynamic one based on the number of entries in the src/icons.json
file, it has revealed there are notably more files in the logos
directory, than there are companies in the JSON file.
To calculate the number of icons previously, I ran this command:
$ ls -lah logos/ | wc -l
6117
As you can see, this would indicate there are 6,114 files (3 deducted from the 6,117 returned from the command due to it returning lines that are not files).
Running a similar command for the companies listed in src/icons.json
, however, reveals there are only 5,882 companies:
$ cat src/icons.json | grep "exchange" | wc -l
5882
As this equates to a lot of files, that can take up quite a bit of disk space, a file needs to be made that can determine which files in the logos
directory are not part of a company listed in src/icons.json
, so they can subsequently be removed.
A script that is reusable will be useful, to ensure that if this situation arises again in the future, there is an automated means of cleaning this up.