Issue:
The variable x was used without being declared in the context of the script, which could cause an error during execution.
Solution:
Replaced the use of the x variable with the latestDate variable in the line defining MAX_AGE. The most recent date among the existing files is directly used to calculate MAX_AGE. This ensures that there is no undefined variable
Issue: The variable x was used without being declared in the context of the script, which could cause an error during execution.
Solution: Replaced the use of the x variable with the latestDate variable in the line defining MAX_AGE. The most recent date among the existing files is directly used to calculate MAX_AGE. This ensures that there is no undefined variable