How to Check the folder name is in date format

Hi
I need to delete the Last two days subfolder which contains the name which is in date format and folder structure is not uniform too
eg: folder1 contains subfolder1 & subfolder2
inside subfolder1 contains date folders
inside subfolder2 contains subfolder1 and subfolder2 and inside subfolder2 contains date folder
When i loop it it has to end where the subfolder name is in date format and delete folder older than two days

we could give you a more close answer by knowing your date format or some sample names. May we ask you to share these details with us. Thanks

hey use this Directory.GetCreationTime(String) Metoda (System.IO) | Microsoft Learn