Next: , Previous: Removing Files, Up: Other Useful CVS Commands

Removing Directories

As I said before, CVS doesn't really keep directories under version control. Instead, as a kind of cheap substitute, it offers certain odd behaviors that in most cases do the "right thing". One of these odd behaviors is that empty directories can be treated specially. If you want to remove a directory from a project, you first remove all the files in it

     floss$ cd dir
     floss$ rm file1 file2 file3
     floss$ cvs remove file1 file2 file3
       (output omitted)
     floss$ cvs ci -m "removed all files" file1 file2 file3
       (output omitted)

and then run update in the directory above it with the -P flag:

     floss$ cd ..
     floss$ cvs update -P
       (output omitted)

The -P option tells update to "prune" any empty directories – that is, to remove them from the working copy. Once that's done, the directory can be said to have been removed; all of its files are gone, and the directory itself is gone (from the working copy, at least, although there is actually still an empty directory in the repository).

An interesting counterpart to this behavior is that when you run a plain update, CVS does not automatically bring new directories from the repository into your working copy. There are a couple of different justifications for this, none really worth going into here. The short answer is that from time to time you should run update with the -d flag, telling it to bring down any new directories from the repository.

Karl Fogel wrote this book. Buy a printed copy via his homepage at

copyright  ©  May 20 2019 sean dreilinger url: