make folder and file deletion smarter