You can use below command to avoid pressying Y Yes every time for a write protected file while deleting all files and folders in a directory in Ubuntu:
rm -f ./Your Parent Directory/*
If you want to do it recursively then do this:
rm -r -f ./Your Parent Directory/*