Cleanup of folders

Job ID: 36751593

Budget: ₹1,250 – ₹2,500 INR

I need a JavaScript to delete the most recently updated folders, the contents of the folders and the connections associated with those folders.

I've written a index_cleanup file that deletes the folders, but it is not deleting the most recent one, instead deleting only the first folder that it is fetching from the given array of folders.