how to delete files with long names in Windows

Recently I downloaded my web server files on the my computer and when trying to delete them, I got the error that the file names were too long and could not be deleted.

Tried a few solutions from the forums but none helped; suddenly DOS struck and I found the solution to this issue

Here's what I did:

Since I was planning to delete the files in the folder cache, I moved it to the root folder - C:\cache

Next, I opened command console

Changed the location to the folder C:\cache

Finally ran the command rmdir /S <foldername>

In my case: rmdir /S C:\cache