There is no way to delete a folder in CVS like you can with files. The directories must be kept so that the versioning information relating to the files which used to be in the repository can still be used (ie: you can revert back to a revision when the files still existed). The only option is to remove all files from within those directories.

If you’re repository has a deep and complicated tree structure, like a lot of projects do, then deleting all of the files from a directory and subdirectories can be a tedious process. Below is a short bash script to make that easier.

files=`find . -type f | grep -v CVS`; echo $files | xargs rm -f; echo $files | xargs cvs rm;

In short, this gathers a list of all files in the directory or subdirectory which are not in CVS metadata directories. It then removes those files from the file system before removing them from CVS. This approach only requires you to enter your password once.

If you don’t want empty directories (ie: deleted directories) to be added to your repository when you update, add the -Pargument to your update command. ie:

cvs up -P

  1. Carrie says:

    Thank you! This is exactly what I was looking for. ~4500 files in 200 directories deleted from CVS in minutes. Excellent

  2. PeterVermont says:

    Thanks! Perfect.