Update PurgeFiles - check if item is a directory

Implemented a check to see if the current item is a folder or file.
If current item is a folder, then remove the folder and everything in it.
If it's a file, remove the file.
Else give a warning.