A storage directory contains hundreds of thousands of files. Compressing or deleting everything at once is not an optimization plan until you know which files hold the actual records.
Count by purpose
Separate canonical JSON records, locks, indexes, cached responses, temporary uploads and recovery artifacts. Sample file names and structures without exposing their contents in a public report. Measure counts and total size for each group.
Look for generated sidecars that outnumber the useful records. A per-record lock or cache file can create substantial directory overhead even when each file is tiny. Removing the files without changing the generator only postpones the problem.
Change the cause carefully
Use a shared locking scheme appropriate to the storage design and retire obsolete sidecars only when they are not held or needed by old workers. Keep cleanup incremental and skip unknown or active files.
Test reads, writes, concurrent updates and recovery with fictional data. Preserve original records and a rollback path before changing how indexes or caches are generated.
File-count reduction is useful only when the service keeps its records and concurrency guarantees. Optimize the generated overhead before touching the source data.