<div id="Adding-and-removing"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[cvs: Recursive behavior#Recursive behavior| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[cvs: Recursive behavior#Recursive behavior| &lt; ]]|</td>
<td valign="middle" align="left">|[[cvs#Top| Up ]]|</td>
<td valign="middle" align="left">|[[#Adding files to a directory| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Adding_002c-removing_002c-and-renaming-files-and-directories"></div>
== Adding, removing, and renaming files and directories ==

In the course of a project, one will often add new
files.  Likewise with removing or renaming, or with
directories.  The general concept to keep in mind in
all these cases is that instead of making an
irreversible change you want <small>CVS</small> to record the
fact that a change has taken place, just as with
modifying an existing file.  The exact mechanisms to do
this in <small>CVS</small> vary depending on the situation.

<div class="menu-preformatted" style="font-family: serif">
 [[#Adding files to a directory|&bull; Adding files]]::                Adding files
 [[#Removing files|&bull; Removing files]]::              Removing files
 [[#Removing directories|&bull; Removing directories]]::        Removing directories
 [[#Moving and renaming files|&bull; Moving files]]::                Moving and renaming files
 [[#Moving and renaming directories|&bull; Moving directories]]::          Moving and renaming directories
</div>


----

<div id="Adding-files"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
<td valign="middle" align="left">|[[#Removing files| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Adding-files-to-a-directory"></div>
=== Adding files to a directory ===
<div id="index-Adding-files"></div>

To add a new file to a directory, follow these steps.


* You must have a working copy of the directory. See section [[cvs: Overview#Getting the source|Getting the source]].


* Create the new file inside your working copy of the directory.


* Use &lsquo;<code>cvs add <var>filename</var></code>&rsquo; to tell <small>CVS</small> that you want to version control the file.  If the file contains binary data, specify &lsquo;<code>-kb</code>&rsquo; (see section [[cvs: Handling binary files#Handling binary files|Handling binary files]]).


* Use &lsquo;<code>cvs commit <var>filename</var></code>&rsquo; to actually check in the file into the repository.  Other developers cannot see the file until you perform this step.

You can also use the <code>add</code> command to add a new
directory.

Unlike most other commands, the <code>add</code> command is
not recursive.  You cannot even type &lsquo;<code>cvs add
foo/bar</code>&rsquo;!  Instead, you have to

<div class="example" style="margin-left: 3.2em">
 $ cd foo
 $ cvs add bar
</div>

<div id="index-add-_0028subcommand_0029"></div>
;<div id="index-cvs-add"></div>Command<nowiki>:</nowiki> <strong>cvs add</strong><em> <nowiki>[</nowiki><code>-k</code> kflag<nowiki>]</nowiki> <nowiki>[</nowiki><code>-m</code> message<nowiki>]</nowiki> files &hellip;</em>

: Schedule <var>files</var> to be added to the repository. The files or directories specified with <code>add</code> must already exist in the current directory.  To add a whole new directory hierarchy to the source repository (for example, files received from a third-party vendor), use the <code>import</code> command instead.  See section [[cvs: Guide to CVS commands#import&mdash;Import sources into CVS, using vendor branches|import&mdash;Import sources into CVS, using vendor branches]].

: The added files are not placed in the source repository until you use <code>commit</code> to make the change permanent.  Doing an <code>add</code> on a file that was removed with the <code>remove</code> command will undo the effect of the <code>remove</code>, unless a <code>commit</code> command intervened.  See section [[#Removing files|Removing files]], for an example.

: The &lsquo;<code>-k</code>&rsquo; option specifies the default way that this file will be checked out; for more information see [[cvs: Keyword substitution#Substitution modes|Substitution modes]].

: The &lsquo;<code>-m</code>&rsquo; option specifies a description for the file.  This description appears in the history log (if it is enabled, see section [[cvs: Reference manual for Administrative files#The history file|The history file]]).  It will also be saved in the version history inside the repository when the file is committed.  The <code>log</code> command displays this description.  The description can be changed using &lsquo;<code>admin -t</code>&rsquo;.  See section [[cvs: Guide to CVS commands#admin&mdash;Administration|admin&mdash;Administration]].  If you omit the &lsquo;<code>-m <var>description</var></code>&rsquo; flag, an empty string will be used.  You will not be prompted for a description.

For example, the following commands add the file
&lsquo;<tt>backend.c</tt>&rsquo; to the repository:

<div class="example" style="margin-left: 3.2em">
 $ cvs add backend.c
 $ cvs commit -m &quot;Early version. Not yet compilable.&quot; backend.c
</div>

When you add a file it is added only on the branch
which you are working on (see section [[cvs: Branching and merging#Branching and merging|Branching and merging]]).  You can
later merge the additions to another branch if you want
(see section [[cvs: Branching and merging#Merging can add or remove files|Merging can add or remove files]]).


----

<div id="Removing-files"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding files to a directory| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
<td valign="middle" align="left">|[[#Removing directories| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Removing-files-1"></div>
=== Removing files ===
<div id="index-Removing-files"></div>
<div id="index-Deleting-files"></div>

Directories change.  New files are added, and old files
disappear.  Still, you want to be able to retrieve an
exact copy of old releases.

Here is what you can do to remove a file,
but remain able to retrieve old revisions:


* Make sure that you have not made any uncommitted modifications to the file.  See section [[cvs: Overview#Viewing differences|Viewing differences]], for one way to do that.  You can also use the <code>status</code> or <code>update</code> command.  If you remove the file without committing your changes, you will of course not be able to retrieve the file as it was immediately before you deleted it.


* Remove the file from your working copy of the directory. You can for instance use <code>rm</code>.


* Use &lsquo;<code>cvs remove <var>filename</var></code>&rsquo; to tell <small>CVS</small> that you really want to delete the file.


* Use &lsquo;<code>cvs commit <var>filename</var></code>&rsquo; to actually perform the removal of the file from the repository.

When you commit the removal of the file, <small>CVS</small>
records the fact that the file no longer exists.  It is
possible for a file to exist on only some branches and
not on others, or to re-add another file with the same
name later.  <small>CVS</small> will correctly create or not create
the file, based on the &lsquo;<code>-r</code>&rsquo; and &lsquo;<code>-D</code>&rsquo; options
specified to <code>checkout</code> or <code>update</code>.

<div id="index-Remove-_0028subcommand_0029"></div>
;<div id="index-cvs-remove"></div>Command<nowiki>:</nowiki> <strong>cvs remove</strong><em> <nowiki>[</nowiki>options<nowiki>]</nowiki> files &hellip;</em>

: Schedule file(s) to be removed from the repository (files which have not already been removed from the working directory are not processed).  This command does not actually remove the file from the repository until you commit the removal.  For a full list of options, see [[cvs: Quick reference to CVS commands#Quick reference to CVS commands|Quick reference to CVS commands]].

Here is an example of removing several files:

<div class="example" style="margin-left: 3.2em">
 $ cd test
 $ rm *.c
 $ cvs remove
 cvs remove: Removing .
 cvs remove: scheduling a.c for removal
 cvs remove: scheduling b.c for removal
 cvs remove: use 'cvs commit' to remove these files permanently
 $ cvs ci -m &quot;Removed unneeded files&quot;
 cvs commit: Examining .
 cvs commit: Committing .
</div>

As a convenience you can remove the file and <code>cvs
remove</code> it in one step, by specifying the &lsquo;<code>-f</code>&rsquo;
option.  For example, the above example could also be
done like this:

<div class="example" style="margin-left: 3.2em">
 $ cd test
 $ cvs remove -f *.c
 cvs remove: scheduling a.c for removal
 cvs remove: scheduling b.c for removal
 cvs remove: use 'cvs commit' to remove these files permanently
 $ cvs ci -m &quot;Removed unneeded files&quot;
 cvs commit: Examining .
 cvs commit: Committing .
</div>

If you execute <code>remove</code> for a file, and then
change your mind before you commit, you can undo the
<code>remove</code> with an <code>add</code> command.


<div class="example" style="margin-left: 3.2em">
 $ ls
 CVS   ja.h  oj.c
 $ rm oj.c
 $ cvs remove oj.c
 cvs remove: scheduling oj.c for removal
 cvs remove: use 'cvs commit' to remove this file permanently
 $ cvs add oj.c
 U oj.c
 cvs add: oj.c, version 1.1.1.1, resurrected
</div>

If you realize your mistake before you run the
<code>remove</code> command you can use <code>update</code> to
resurrect the file:

<div class="example" style="margin-left: 3.2em">
 $ rm oj.c
 $ cvs update oj.c
 cvs update: warning: oj.c was lost
 U oj.c
</div>

When you remove a file it is removed only on the branch
which you are working on (see section [[cvs: Branching and merging#Branching and merging|Branching and merging]]).  You can
later merge the removals to another branch if you want
(see section [[cvs: Branching and merging#Merging can add or remove files|Merging can add or remove files]]).


----

<div id="Removing-directories"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Removing files| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming files| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Removing-directories-1"></div>
=== Removing directories ===
<div id="index-Removing-directories"></div>
<div id="index-Directories_002c-removing"></div>

In concept removing directories is somewhat similar to
removing files&mdash;you want the directory to not exist in
your current working directories, but you also want to
be able to retrieve old releases in which the directory
existed.

The way that you remove a directory is to remove all
the files in it.  You don&rsquo;t remove the directory
itself; there is no way to do that.
Instead you specify the &lsquo;<code>-P</code>&rsquo; option to
<code>cvs update</code> or <code>cvs checkout</code>,
which will cause <small>CVS</small> to remove empty
directories from working directories.
(Note that <code>cvs export</code> always removes empty directories.)
Probably the
best way to do this is to always specify &lsquo;<code>-P</code>&rsquo;; if
you want an empty directory then put a dummy file (for
example &lsquo;<tt>.keepme</tt>&rsquo;) in it to prevent &lsquo;<code>-P</code>&rsquo; from
removing it.

Note that &lsquo;<code>-P</code>&rsquo; is implied by the &lsquo;<code>-r</code>&rsquo; or &lsquo;<code>-D</code>&rsquo;
options of <code>checkout</code>.  This way
<small>CVS</small> will be able to correctly create the directory
or not depending on whether the particular version you
are checking out contains any files in that directory.


----

<div id="Moving-files"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Removing directories| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
<td valign="middle" align="left">|[[#The Normal way to Rename| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Moving-and-renaming-files"></div>
=== Moving and renaming files ===
<div id="index-Moving-files"></div>
<div id="index-Renaming-files"></div>
<div id="index-Files_002c-moving"></div>

Moving files to a different directory or renaming them
is not difficult, but some of the ways in which this
works may be non-obvious.  (Moving or renaming a
directory is even harder.  See section [[#Moving and renaming directories|Moving and renaming directories]].).

The examples below assume that the file <var>old</var> is renamed to
<var>new</var>.

<div class="menu-preformatted" style="font-family: serif">
 [[#The Normal way to Rename|&bull; Outside]]::                     The normal way to Rename
 [[#Moving the history file|&bull; Inside]]::                      A tricky, alternative way
 [[#Copying the history file|&bull; Rename by copying]]::           Another tricky, alternative way
</div>


----

<div id="Outside"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming files| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
<td valign="middle" align="left">|[[#Moving the history file| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="The-Normal-way-to-Rename"></div>
==== The Normal way to Rename ====


The normal way to move a file is to copy <var>old</var> to
<var>new</var>, and then issue the normal <small>CVS</small> commands
to remove <var>old</var> from the repository, and add
<var>new</var> to it.

<div class="example" style="margin-left: 3.2em">
 $ mv <var>old</var> <var>new</var>
 $ cvs remove <var>old</var>
 $ cvs add <var>new</var>
 $ cvs commit -m &quot;Renamed <var>old</var> to <var>new</var>&quot; <var>old</var> <var>new</var>
</div>

This is the simplest way to move a file, it is not
error-prone, and it preserves the history of what was
done.  Note that to access the history of the file you
must specify the old or the new name, depending on what
portion of the history you are accessing.  For example,
<code>cvs log <var>old</var></code> will give the log up until the
time of the rename.

When <var>new</var> is committed its revision numbers will
start again, usually at 1.1, so if that bothers you,
use the &lsquo;<code>-r rev</code>&rsquo; option to commit.  For more
information see [[cvs: Revisions#Assigning revisions|Assigning revisions]].


----

<div id="Inside"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#The Normal way to Rename| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
<td valign="middle" align="left">|[[#Copying the history file| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Moving-the-history-file"></div>
==== Moving the history file ====

This method is more dangerous, since it involves moving
files inside the repository.  Read this entire section
before trying it out!

<div class="example" style="margin-left: 3.2em">
 $ cd $CVSROOT/<var>dir</var>
 $ mv <var>old</var>,v <var>new</var>,v
</div>

Advantages:


* The log of changes is maintained intact.


* The revision numbers are not affected.

Disadvantages:


* Old releases cannot easily be fetched from the repository.  (The file will show up as <var>new</var> even in revisions from the time before it was renamed).


* There is no log information of when the file was renamed.


* Nasty things might happen if someone accesses the history file while you are moving it.  Make sure no one else runs any of the <small>CVS</small> commands while you move it.


----

<div id="Rename-by-copying"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Moving the history file| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming files| Up ]]|</td>
<td valign="middle" align="left">|[[#Moving and renaming directories| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Copying-the-history-file"></div>
==== Copying the history file ====

This way also involves direct modifications to the
repository.  It is safe, but not without drawbacks.

<div class="example" style="margin-left: 3.2em">
 # <span class="roman" style="font-family:serif; font-weight:normal">Copy the RCS file inside the repository</span>
 $ cd $CVSROOT/<var>dir</var>
 $ cp <var>old</var>,v <var>new</var>,v
 # <span class="roman" style="font-family:serif; font-weight:normal">Remove the old file</span>
 $ cd ~/<var>dir</var>
 $ rm <var>old</var>
 $ cvs remove <var>old</var>
 $ cvs commit <var>old</var>
 # <span class="roman" style="font-family:serif; font-weight:normal">Remove all tags from <var>new</var></span>
 $ cvs update <var>new</var>
 $ cvs log <var>new</var>             # <span class="roman" style="font-family:serif; font-weight:normal">Remember the non-branch tag names</span>
 $ cvs tag -d <var>tag1</var> <var>new</var>
 $ cvs tag -d <var>tag2</var> <var>new</var>
 &hellip;
</div>

By removing the tags you will be able to check out old
revisions.

Advantages:


* Checking out old revisions works correctly, as long as you use &lsquo;<code>-r<var>tag</var></code>&rsquo; and not &lsquo;<code>-D<var>date</var></code>&rsquo; to retrieve the revisions.


* The log of changes is maintained intact.


* The revision numbers are not affected.

Disadvantages:


* You cannot easily see the history of the file across the rename.



----

<div id="Moving-directories"></div>
<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[#Copying the history file| &lt; ]]|</td>
<td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| Up ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
<div id="Moving-and-renaming-directories"></div>
=== Moving and renaming directories ===
<div id="index-Moving-directories"></div>
<div id="index-Renaming-directories"></div>
<div id="index-Directories_002c-moving"></div>

The normal way to rename or move a directory is to
rename or move each file within it as described in
[[#The Normal way to Rename|The Normal way to Rename]].  Then check out with the &lsquo;<code>-P</code>&rsquo;
option, as described in [[#Removing directories|Removing directories]].

If you really want to hack the repository to rename or
delete a directory in the repository, you can do it
like this:


# Inform everyone who has a checked out copy of the directory that the directory will be renamed.  They should commit all their changes, and remove their working copies, before you take the steps below.


# Rename the directory inside the repository.

<div class="example" style="margin-left: 3.2em">
 $ cd $CVSROOT/<var>parent-dir</var>
 $ mv <var>old-dir</var> <var>new-dir</var>
</div>


# Fix the <small>CVS</small> administrative files, if necessary (for instance if you renamed an entire module).


# Tell everyone that they can check out again and continue working.


If someone had a working copy the <small>CVS</small> commands will
cease to work for him, until he removes the directory
that disappeared inside the repository.

It is almost always better to move the files in the
directory instead of moving the directory.  If you move the
directory you are unlikely to be able to retrieve old
releases correctly, since they probably depend on the
name of the directories.


----

<table class="header" cellpadding="1" cellspacing="1" border="0">
<tr><td valign="middle" align="left">|[[#Adding, removing, and renaming files and directories| &lt;&lt; ]]|</td>
<td valign="middle" align="left">|[[cvs: History browsing#History browsing| &gt;&gt; ]]|</td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left"> &nbsp; </td>
<td valign="middle" align="left">|[[cvs#Top|Top]]|</td>
<td valign="middle" align="left">|[[cvs: Table of Contents#SEC_Contents|Contents]]|</td>
<td valign="middle" align="left">|[[cvs: Index#Index|Index]]|</td>
<td valign="middle" align="left">|[[cvs: About this Manual#SEC_About| ? ]]|</td>
</tr></table>
This document was generated on <i>a sunny day</i> using [http://www.nongnu.org/texi2html/ <i>texi2html</i>].
