Renaming All Files and remove spaces

I have uploaded more than 6000 files in one directory, those files contains space in their names for example abc (12).png

I want to rename all files and remove spaces from their names. what is the easiest way to do so?
abc (12).png -> abc(12).png

Hi Noman,

I suppose the easiest way would be to sequentially retrieve and rename the files using File Directory Listing API and Rename File/Directory API.